comfy-ts 0.2.0 → 0.4.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/LICENSE +21 -0
- package/README.md +363 -0
- package/dist/cli.js +764 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +4171 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9910 -0
- package/dist/index.d.ts +9894 -58
- package/dist/index.js +4092 -2
- package/dist/index.js.map +1 -1
- package/dist/log-CdfgILde.js +10 -0
- package/dist/log-CdfgILde.js.map +1 -0
- package/dist/run-tui-SDSJo1Qf.js +3896 -0
- package/dist/run-tui-SDSJo1Qf.js.map +1 -0
- package/package.json +103 -75
- package/src/cli/comfy-ts-cli.ts +36 -0
- package/src/cli/gen.ts +47 -0
- package/src/cli/outline.ts +82 -0
- package/src/cli/tui/components/DraftsOverlay.tsx +44 -0
- package/src/cli/tui/components/EditField.tsx +27 -0
- package/src/cli/tui/components/Header.tsx +56 -0
- package/src/cli/tui/components/HostPanel.tsx +37 -0
- package/src/cli/tui/components/LogsPanel.tsx +23 -0
- package/src/cli/tui/components/LorasOverlay.tsx +49 -0
- package/src/cli/tui/components/OverlayList.tsx +25 -0
- package/src/cli/tui/components/PickerOverlays.tsx +66 -0
- package/src/cli/tui/components/PreviewPanel.tsx +78 -0
- package/src/cli/tui/components/PromptOverlay.tsx +16 -0
- package/src/cli/tui/components/StatusBar.tsx +171 -0
- package/src/cli/tui/components/TextOverlay.tsx +72 -0
- package/src/cli/tui/components/TreePanel.tsx +51 -0
- package/src/cli/tui/components/TuiApp.tsx +246 -0
- package/src/cli/tui/components/VarsPanel.tsx +86 -0
- package/src/cli/tui/findDefinedWorkflow.ts +16 -0
- package/src/cli/tui/keys.ts +20 -0
- package/src/cli/tui/protocolImagePainter.ts +95 -0
- package/src/cli/tui/run-tui.tsx +76 -0
- package/src/cli/tui/state/DraftsSt.ts +273 -0
- package/src/cli/tui/state/EditorSt.ts +289 -0
- package/src/cli/tui/state/ExecSt.ts +173 -0
- package/src/cli/tui/state/HostSt.ts +230 -0
- package/src/cli/tui/state/LogsSt.ts +107 -0
- package/src/cli/tui/state/LorasSt.ts +185 -0
- package/src/cli/tui/state/PickerSt.ts +112 -0
- package/src/cli/tui/state/PreviewSt.ts +288 -0
- package/src/cli/tui/state/QueueSt.ts +59 -0
- package/src/cli/tui/state/SettingsSt.ts +100 -0
- package/src/cli/tui/state/TreeSt.ts +122 -0
- package/src/cli/tui/state/TuiSt.ts +175 -0
- package/src/cli/tui/state/WorkflowsSt.ts +93 -0
- package/src/cli/tui-env.ts +8 -0
- package/src/errors/InvalidPromptError.ts +12 -0
- package/src/graph/ComfyNode.ts +403 -0
- package/src/graph/ComfyNodeID.ts +28 -0
- package/src/graph/ComfyNodeOutput.ts +16 -0
- package/src/graph/NodeSlotSize.ts +4 -0
- package/src/graph/autoValue.ts +17 -0
- package/src/host/ComfyHost.ts +690 -0
- package/src/host/ComfyInstallType.ts +15 -0
- package/src/host/ComfyManager.ts +232 -0
- package/src/host/ComfyUploader.ts +110 -0
- package/src/host/ComfyWorkflowBuilder.ts +60 -0
- package/src/host/Requirements.ts +55 -0
- package/src/host/ResilientWebsocket.ts +147 -0
- package/src/host/loraManagerApi.ts +98 -0
- package/src/image-utils/_getPngMetadata.ts +53 -0
- package/src/image-utils/_getWebpMetadata.ts +38 -0
- package/src/image-utils/_parseExifData.ts +53 -0
- package/src/index.ts +89 -0
- package/src/litegraph/LiteGraphGroup.ts +22 -0
- package/src/litegraph/LiteGraphJSON.ts +46 -0
- package/src/litegraph/LiteGraphLink.ts +23 -0
- package/src/litegraph/LiteGraphLinkID.ts +6 -0
- package/src/litegraph/LiteGraphNode.ts +69 -0
- package/src/litegraph/LiteGraphNodeInput.ts +27 -0
- package/src/litegraph/LiteGraphNodeOutput.ts +23 -0
- package/src/litegraph/LiteGraphSlotIndex.ts +6 -0
- package/src/litegraph/convertFlowToLiteGraphJSON.ts +114 -0
- package/src/manager/ComfyRegistry.ts +124 -0
- package/src/manager/generated/KnownComfyCustomNodeName.ts +19280 -0
- package/src/manager/generated/KnownComfyPluginTitle.ts +5130 -0
- package/src/manager/generated/KnownComfyPluginURL.ts +2589 -0
- package/src/manager/generated/KnownModel_Base.ts +126 -0
- package/src/manager/generated/KnownModel_FileName.ts +2287 -0
- package/src/manager/generated/KnownModel_Name.ts +2287 -0
- package/src/manager/generated/KnownModel_SavePath.ts +263 -0
- package/src/manager/generated/KnownModel_Type.ts +97 -0
- package/src/manager/json/alter-list.json +224 -0
- package/src/manager/json/custom-node-list.extra.ts +13 -0
- package/src/manager/json/custom-node-list.json +21948 -0
- package/src/manager/json/extension-node-map.json +31282 -0
- package/src/manager/json/github-stats.json +12602 -0
- package/src/manager/json/model-list.extra.ts +26 -0
- package/src/manager/json/model-list.json +5052 -0
- package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +56 -0
- package/src/manager/loaders/step2_custom-node-list-loader.ts +149 -0
- package/src/manager/loaders/step3_extension-node-map-loader.ts +189 -0
- package/src/manager/loaders/step4_model-list-loader.ts +159 -0
- package/src/manager/script-update-manager.bun.ts +18 -0
- package/src/manager/types/ComfyManagerAPIFetchPolicy.ts +9 -0
- package/src/manager/types/ComfyManagerAPIModelList.ts +10 -0
- package/src/manager/types/ComfyManagerAPIPluginList.ts +11 -0
- package/src/manager/types/ComfyManagerFileModelInfo.ts +5 -0
- package/src/manager/types/ComfyManagerFilePluginContent.ts +13 -0
- package/src/manager/types/ComfyManagerFilePluginList.ts +5 -0
- package/src/manager/types/ComfyManagerModelInfo.ts +18 -0
- package/src/manager/types/ComfyManagerPluginContentMetadata.ts +16 -0
- package/src/manager/types/ComfyManagerPluginEnums.ts +8 -0
- package/src/manager/types/ComfyManagerPluginInfo.ts +50 -0
- package/src/runner/ComfyExecution.ts +301 -0
- package/src/runner/ComfyExecutionStatus.ts +2 -0
- package/src/runner/ComfyWorkflow.ts +395 -0
- package/src/runner/ComfyWorkflowLayout.ts +96 -0
- package/src/runner/ComfyWsApi.ts +170 -0
- package/src/runner/MediaImage.ts +262 -0
- package/src/sdk-generator/ComfyNodeSchema.ts +79 -0
- package/src/sdk-generator/ComfySchema.ts +369 -0
- package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +95 -0
- package/src/sdk-generator/Primitives.ts +76 -0
- package/src/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.ts +39 -0
- package/src/sdk-generator/_pythonModuleToNamespace.ts +27 -0
- package/src/sdk-generator/_toQualifiedNodeKey.ts +5 -0
- package/src/sdk-generator/comfy-api-json.ts +16 -0
- package/src/sdk-generator/comfyui-sdk-codegen.ts +287 -0
- package/src/sdk-generator/comfyui-types.ts +56 -0
- package/src/sdk-generator/litegraphToApiRequestPayload.ts +157 -0
- package/src/ssh-host-manager/ssh-config-manager.ts +89 -0
- package/src/ssh-host-manager/ssh-config.windows.md +32 -0
- package/src/ssh-host-manager/ssh-manager.ts +114 -0
- package/src/state.ts +136 -0
- package/src/types/comfy-sdk.ts +106 -0
- package/src/types/index.ts +55 -0
- package/src/utils/CodeBuffer.ts +61 -0
- package/src/utils/ComfyColors.ts +38 -0
- package/src/utils/ansi.ts +33 -0
- package/src/utils/ansiImage.ts +36 -0
- package/src/utils/bang.ts +39 -0
- package/src/utils/deepCopyNaive.ts +1 -0
- package/src/utils/downloadFile.ts +77 -0
- package/src/utils/escapeJSKey.ts +32 -0
- package/src/utils/exhaust.ts +4 -0
- package/src/utils/extractErrorMessage.ts +11 -0
- package/src/utils/fuzzyMatch.ts +8 -0
- package/src/utils/githubRegexes.ts +2 -0
- package/src/utils/hashArrayBuffer.ts +6 -0
- package/src/utils/log.ts +9 -0
- package/src/utils/loraTag.ts +10 -0
- package/src/utils/mojibake.ts +60 -0
- package/src/utils/printArkResultInConsole.ts +16 -0
- package/src/utils/softValidate.ts +8 -0
- package/src/utils/stringifyReadable.ts +32 -0
- package/src/utils/toposort.ts +59 -0
- package/src/utils/tryExtracting.ts +41 -0
- package/src/utils/writeFile.ts +16 -0
- package/src/vars/ComfyVars.ts +531 -0
- package/src/vars/DefinedWorkflow.ts +112 -0
- package/src/vars/loraKeywords.ts +56 -0
- package/dist/index.d.mts +0 -74
- package/dist/index.mjs +0 -3
- package/dist/index.mjs.map +0 -1
- package/readme.md +0 -40
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import crypto from 'node:crypto'
|
|
2
|
+
import { getUnionNameBasedOnFirstFoundEnumName } from 'src/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.ts'
|
|
3
|
+
import { toQualifiedNodeKey } from 'src/sdk-generator/_toQualifiedNodeKey.ts'
|
|
4
|
+
import { ComfyNodeSchema } from 'src/sdk-generator/ComfyNodeSchema.ts'
|
|
5
|
+
import type { ComfyEnumDef, ComfyNodeSchemaJSON, ComfySchemaJSON } from 'src/sdk-generator/ComfyUIObjectInfoTypes.ts'
|
|
6
|
+
import { codegenSDK } from 'src/sdk-generator/comfyui-sdk-codegen.ts'
|
|
7
|
+
import {
|
|
8
|
+
asComfyNodeSlotName,
|
|
9
|
+
asComfyNodeSlotTypeName,
|
|
10
|
+
type ComfyImageName,
|
|
11
|
+
type ComfyNodeSlotName,
|
|
12
|
+
type ComfyNodeSlotTypeName,
|
|
13
|
+
type ComfyPythonModule,
|
|
14
|
+
type ComfyUnionHash,
|
|
15
|
+
type ComfyUnionInfo,
|
|
16
|
+
type ComfyUnionName,
|
|
17
|
+
type ComfyUnionValue,
|
|
18
|
+
type EmbeddingName,
|
|
19
|
+
type NodeInputExt,
|
|
20
|
+
type NodeNameInComfy,
|
|
21
|
+
type NodeOutputExt,
|
|
22
|
+
type QualifiedNodeKey,
|
|
23
|
+
} from 'src/sdk-generator/comfyui-types.ts'
|
|
24
|
+
import {
|
|
25
|
+
ComfyDefaultNodeWhenUnknown_Name,
|
|
26
|
+
ComfyDefaultNodeWhenUnknown_Schema,
|
|
27
|
+
ComfyPrimitiveMapping,
|
|
28
|
+
ComfyPrimitives,
|
|
29
|
+
} from 'src/sdk-generator/Primitives.ts'
|
|
30
|
+
import type { Maybe } from 'src/types/index.ts'
|
|
31
|
+
import { escapeJSKey } from 'src/utils/escapeJSKey.ts'
|
|
32
|
+
import { logInfo } from 'src/utils/log.ts'
|
|
33
|
+
|
|
34
|
+
export type ComfySchemaId = string
|
|
35
|
+
|
|
36
|
+
export type ComfySchemaData = {
|
|
37
|
+
spec: ComfySchemaJSON
|
|
38
|
+
embeddings: string[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* ONE host's schema: the parsed view of its object_info.json + embeddings.
|
|
43
|
+
* Owns union dedup (by sha1 of values), node indexing, and the per-host
|
|
44
|
+
* sdk codegen (`codegenDTS`).
|
|
45
|
+
*/
|
|
46
|
+
export class ComfySchema {
|
|
47
|
+
codegenDTS = codegenSDK.bind(this)
|
|
48
|
+
|
|
49
|
+
constructor(public data: ComfySchemaData) {
|
|
50
|
+
this.parse()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
update(data: Partial<ComfySchemaData>): void {
|
|
54
|
+
const prev: ComfySchemaData = { spec: this.data.spec, embeddings: this.data.embeddings }
|
|
55
|
+
Object.assign(this.data, data)
|
|
56
|
+
try {
|
|
57
|
+
this.parse()
|
|
58
|
+
this.isInvalid = false
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error(`❌ [ComfySchema.update] bad schema — keeping the previous one`, error)
|
|
61
|
+
// roll back: a failed update must not leave half-built indexes in use
|
|
62
|
+
this.data = prev
|
|
63
|
+
try {
|
|
64
|
+
this.parse()
|
|
65
|
+
} catch {
|
|
66
|
+
// previous data unparsable too (first update): indexes stay empty
|
|
67
|
+
}
|
|
68
|
+
this.isInvalid = true
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isInvalid: boolean = false
|
|
73
|
+
|
|
74
|
+
/** number of nodes in the current schema (quick way to check your instance infos) */
|
|
75
|
+
get size(): number {
|
|
76
|
+
return Object.keys(this.data.spec).length
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// #region parsed indexes
|
|
80
|
+
knownSlotTypes = new Set<ComfyNodeSlotTypeName>()
|
|
81
|
+
knownUnionBySlotName = new Map<ComfyNodeSlotName, ComfyUnionInfo>()
|
|
82
|
+
knownUnionByHash = new Map<ComfyUnionHash, ComfyUnionInfo>()
|
|
83
|
+
knownUnionByName = new Map<ComfyUnionName, ComfyUnionInfo>()
|
|
84
|
+
nodes: ComfyNodeSchema[] = []
|
|
85
|
+
pythonModuleByNodeKey: Map<QualifiedNodeKey, ComfyPythonModule> = new Map()
|
|
86
|
+
pythonModuleByNodeNameInComfy: Map<NodeNameInComfy, ComfyPythonModule> = new Map()
|
|
87
|
+
nodesByNameInComfy: { [key: NodeNameInComfy]: ComfyNodeSchema } = {}
|
|
88
|
+
nodesByKey: { [key: QualifiedNodeKey]: ComfyNodeSchema } = {}
|
|
89
|
+
nodesByProduction: { [key in ComfyNodeSlotTypeName]?: ComfyNodeSchema[] } = {}
|
|
90
|
+
|
|
91
|
+
// some nodes output anonymous unions. we need to keep track of them for codegen
|
|
92
|
+
enumsAppearingInOutput = new Set<ComfyNodeSlotTypeName>()
|
|
93
|
+
|
|
94
|
+
pythonModules = new Map<string, NodeNameInComfy[]>()
|
|
95
|
+
|
|
96
|
+
// #region parse
|
|
97
|
+
private parse(): void {
|
|
98
|
+
// reset all indexes: parse() re-runs on every update()
|
|
99
|
+
this.knownSlotTypes.clear()
|
|
100
|
+
this.knownUnionBySlotName.clear()
|
|
101
|
+
this.knownUnionByHash.clear()
|
|
102
|
+
this.knownUnionByName.clear()
|
|
103
|
+
this.nodes = []
|
|
104
|
+
this.pythonModuleByNodeKey.clear()
|
|
105
|
+
this.pythonModuleByNodeNameInComfy.clear()
|
|
106
|
+
this.nodesByNameInComfy = {}
|
|
107
|
+
this.nodesByKey = {}
|
|
108
|
+
this.nodesByProduction = {}
|
|
109
|
+
this.enumsAppearingInOutput.clear()
|
|
110
|
+
this.pythonModules.clear()
|
|
111
|
+
|
|
112
|
+
// skip log for the initial dummy empty data
|
|
113
|
+
if (this.data.embeddings.length > 0 || Object.keys(this.data.spec).length > 0)
|
|
114
|
+
this.log(`parsing ComfyUI object_info.json`)
|
|
115
|
+
|
|
116
|
+
const entries: [string, ComfyNodeSchemaJSON][] = Object.entries(this.data.spec)
|
|
117
|
+
entries.push([ComfyDefaultNodeWhenUnknown_Name, ComfyDefaultNodeWhenUnknown_Schema])
|
|
118
|
+
|
|
119
|
+
for (const [KK, VV] of entries) {
|
|
120
|
+
// record python module
|
|
121
|
+
const pythonModule = VV.python_module
|
|
122
|
+
const prev = this.pythonModules.get(pythonModule)
|
|
123
|
+
if (prev == null) this.pythonModules.set(pythonModule, [KK])
|
|
124
|
+
else prev.push(KK)
|
|
125
|
+
|
|
126
|
+
const nodeNameInComfy = KK
|
|
127
|
+
const nodeDef = VV
|
|
128
|
+
const nodeKey = toQualifiedNodeKey(pythonModule, nodeNameInComfy)
|
|
129
|
+
|
|
130
|
+
if (typeof nodeDef.output === 'string') {
|
|
131
|
+
console.log(
|
|
132
|
+
`[❌ ERROR] nodeDef ${nodeDef.name} has an invalid output definition: ${JSON.stringify(nodeDef.output)}`,
|
|
133
|
+
)
|
|
134
|
+
nodeDef.output = []
|
|
135
|
+
}
|
|
136
|
+
this.pythonModuleByNodeKey.set(nodeKey, pythonModule)
|
|
137
|
+
this.pythonModuleByNodeNameInComfy.set(nodeNameInComfy, pythonModule)
|
|
138
|
+
|
|
139
|
+
const inputs: NodeInputExt[] = []
|
|
140
|
+
const outputs: NodeOutputExt[] = []
|
|
141
|
+
const node = new ComfyNodeSchema(VV, nodeNameInComfy, nodeKey, nodeDef.category, inputs, outputs, pythonModule)
|
|
142
|
+
|
|
143
|
+
// INDEX NODE
|
|
144
|
+
this.nodesByNameInComfy[nodeNameInComfy] = node
|
|
145
|
+
this.nodesByKey[nodeKey] = node
|
|
146
|
+
this.nodes.push(node)
|
|
147
|
+
|
|
148
|
+
// #region outputs ----------------------------------------------------------------------
|
|
149
|
+
const nameCountDict: { [key: string]: number } = {}
|
|
150
|
+
for (const [ix, slotType] of nodeDef.output.entries()) {
|
|
151
|
+
const rawOutputSlotName =
|
|
152
|
+
nodeDef.output_name[ix] || //
|
|
153
|
+
(typeof slotType === 'string' ? slotType : `input_${ix}`)
|
|
154
|
+
|
|
155
|
+
const outputNameInComfy = rawOutputSlotName
|
|
156
|
+
const at = (nameCountDict[outputNameInComfy] ??= 0)
|
|
157
|
+
const outKeyValue = at === 0 ? outputNameInComfy : `${outputNameInComfy}_${at}`
|
|
158
|
+
nameCountDict[outputNameInComfy]++
|
|
159
|
+
|
|
160
|
+
let slotTypeName: ComfyNodeSlotTypeName
|
|
161
|
+
const outputSlotName = asComfyNodeSlotName(`${node.nodeKey}.${outKeyValue}.OUT`)
|
|
162
|
+
|
|
163
|
+
// 1. Primitive
|
|
164
|
+
if (typeof slotType === 'string') {
|
|
165
|
+
slotTypeName = asComfyNodeSlotTypeName(slotType)
|
|
166
|
+
this.knownSlotTypes.add(slotTypeName)
|
|
167
|
+
}
|
|
168
|
+
// 2. ENUM
|
|
169
|
+
else if (Array.isArray(slotType)) {
|
|
170
|
+
const RESX = this.processSlot({ pythonModule, slotName: outputSlotName, comfyUnionDef: slotType })
|
|
171
|
+
slotTypeName = asComfyNodeSlotTypeName(RESX.unionName)
|
|
172
|
+
this.enumsAppearingInOutput.add(slotTypeName)
|
|
173
|
+
}
|
|
174
|
+
// 3. ????
|
|
175
|
+
else {
|
|
176
|
+
throw new Error(`invalid output ${ix} "${slotType}" in node "${nodeNameInComfy}"`)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// index production
|
|
180
|
+
const arr = this.nodesByProduction[slotTypeName]
|
|
181
|
+
if (arr == null) this.nodesByProduction[slotTypeName] = [node]
|
|
182
|
+
else arr.push(node)
|
|
183
|
+
|
|
184
|
+
outputs.push({
|
|
185
|
+
slotName: outputSlotName,
|
|
186
|
+
typeName: slotTypeName,
|
|
187
|
+
nameInComfy: outputNameInComfy,
|
|
188
|
+
outKey: outKeyValue,
|
|
189
|
+
isPrimitive: false,
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// #region inputs ----------------------------------------------------------------------
|
|
194
|
+
const optionalInputs = Object.entries(nodeDef.input?.optional ?? {}) //
|
|
195
|
+
.map(([name, spec]) => ({ required: false, name, spec }))
|
|
196
|
+
|
|
197
|
+
const requiredInputs = Object.entries(nodeDef.input?.required ?? {}) //
|
|
198
|
+
.map(([name, spec]) => ({ required: true, name, spec }))
|
|
199
|
+
// when an input is BOTH required and optional (seen in the wild), keep the optional one
|
|
200
|
+
.filter((i) => optionalInputs.find((oi) => oi.name === i.name) == null)
|
|
201
|
+
const allInputs = [...requiredInputs, ...optionalInputs]
|
|
202
|
+
|
|
203
|
+
for (const ipt of allInputs) {
|
|
204
|
+
const inputNameInComfy = ipt.name
|
|
205
|
+
const typeDef = ipt.spec
|
|
206
|
+
const slotType = typeDef[0]
|
|
207
|
+
const slotOpts = typeDef[1]
|
|
208
|
+
|
|
209
|
+
let inputTypeName: ComfyNodeSlotTypeName
|
|
210
|
+
const inputSlotName = asComfyNodeSlotName(`${node.nodeKey}.${inputNameInComfy}`)
|
|
211
|
+
|
|
212
|
+
// 1/4 broken input (null type)
|
|
213
|
+
if (slotType == null) {
|
|
214
|
+
const RESX = this.processSlot({ pythonModule, slotName: inputSlotName, comfyUnionDef: ['❌'] })
|
|
215
|
+
inputTypeName = asComfyNodeSlotTypeName(RESX.unionName)
|
|
216
|
+
}
|
|
217
|
+
// 2/4 named slot type
|
|
218
|
+
else if (typeof slotType === 'string') {
|
|
219
|
+
inputTypeName = asComfyNodeSlotTypeName(slotType)
|
|
220
|
+
this.knownSlotTypes.add(inputTypeName)
|
|
221
|
+
}
|
|
222
|
+
// 3/4 inline enum
|
|
223
|
+
else if (Array.isArray(slotType)) {
|
|
224
|
+
const RESX = this.processSlot({ pythonModule, slotName: inputSlotName, comfyUnionDef: slotType })
|
|
225
|
+
inputTypeName = asComfyNodeSlotTypeName(RESX.unionName)
|
|
226
|
+
}
|
|
227
|
+
// 4/4
|
|
228
|
+
else {
|
|
229
|
+
throw new Error(
|
|
230
|
+
`invalid schema (${JSON.stringify(slotType)}) for input "${
|
|
231
|
+
ipt.name
|
|
232
|
+
}" in node "${nodeNameInComfy}" (type: ${typeof slotType}; expected: Array | string)`,
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
node.inputs.push({
|
|
237
|
+
slotName: inputSlotName,
|
|
238
|
+
required: ipt.required,
|
|
239
|
+
nameInComfy: inputNameInComfy,
|
|
240
|
+
nameInComfyEscaped: escapeJSKey(inputNameInComfy),
|
|
241
|
+
typeName: inputTypeName,
|
|
242
|
+
opts: slotOpts,
|
|
243
|
+
isPrimitive: ComfyPrimitives.includes(inputTypeName),
|
|
244
|
+
isEnum: this.knownUnionByName.has(inputTypeName),
|
|
245
|
+
index: node.inputs.length,
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// #region processSlot
|
|
252
|
+
processSlot = (p: {
|
|
253
|
+
pythonModule: string
|
|
254
|
+
slotName: ComfyNodeSlotName
|
|
255
|
+
comfyUnionDef: ComfyEnumDef
|
|
256
|
+
}): ComfyUnionInfo => {
|
|
257
|
+
// 1. build enum
|
|
258
|
+
const enumValues: ComfyUnionValue[] = []
|
|
259
|
+
for (const enumValue of p.comfyUnionDef) {
|
|
260
|
+
if (typeof enumValue === 'string') enumValues.push(enumValue)
|
|
261
|
+
else if (typeof enumValue === 'boolean') enumValues.push(enumValue)
|
|
262
|
+
else if (typeof enumValue === 'number') enumValues.push(enumValue)
|
|
263
|
+
else enumValues.push(enumValue.content)
|
|
264
|
+
}
|
|
265
|
+
// 2. hash its value
|
|
266
|
+
const hashContent =
|
|
267
|
+
enumValues.length === 0 //
|
|
268
|
+
? `[[empty]]`
|
|
269
|
+
: enumValues.sort().join('|')
|
|
270
|
+
const hash = crypto.createHash('sha1').update(hashContent).digest('hex').slice(0, 8)
|
|
271
|
+
|
|
272
|
+
// 3. retrieve or create an EnumInfo
|
|
273
|
+
let unionInfo: Maybe<ComfyUnionInfo> = this.knownUnionByHash.get(hash)
|
|
274
|
+
if (unionInfo == null) {
|
|
275
|
+
const unionName = getUnionNameBasedOnFirstFoundEnumName(p.slotName, hash, hashContent)
|
|
276
|
+
unionInfo = { hash, unionName, values: enumValues, enumNames: [] }
|
|
277
|
+
this.knownUnionByHash.set(hash, unionInfo)
|
|
278
|
+
this.knownUnionByName.set(unionName, unionInfo)
|
|
279
|
+
}
|
|
280
|
+
unionInfo.enumNames.push(p.slotName)
|
|
281
|
+
|
|
282
|
+
// 4. store enum by name
|
|
283
|
+
this.knownUnionBySlotName.set(p.slotName, unionInfo)
|
|
284
|
+
return unionInfo
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
private log(...args: unknown[]): void {
|
|
288
|
+
logInfo(`[👅]: ${args.join(' ')}`)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
toTSType(t: string): string {
|
|
292
|
+
// '*' is ComfyUI's wildcard: any output or primitive fits
|
|
293
|
+
if (t === '*') return `string | number | boolean | ComfyNodeOutput<string, number>`
|
|
294
|
+
return ComfyPrimitiveMapping[t]
|
|
295
|
+
? `${ComfyPrimitiveMapping[t]} | ComfyNodeOutput<'${t}'>`
|
|
296
|
+
: `ComfyNodeOutput<'${t}'>`
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
toAcceptsType(t: string): string {
|
|
300
|
+
return `ComfyNodeOutput<'${t}'>`
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// #region discovery helpers
|
|
304
|
+
/**
|
|
305
|
+
* every possible value for a given slot, straight from the live schema.
|
|
306
|
+
* e.g. schema.values('LoraLoader.lora_name') -> all loras on this host
|
|
307
|
+
*/
|
|
308
|
+
values(slotName: string): ComfyUnionValue[] {
|
|
309
|
+
return this.knownUnionBySlotName.get(asComfyNodeSlotName(slotName))?.values ?? []
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** string values only (most enums are), for quick discovery */
|
|
313
|
+
stringValues(slotName: string): string[] {
|
|
314
|
+
return this.values(slotName).filter((v): v is string => typeof v === 'string')
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* for now, simply ensure that the number of parsed nodes matches the number
|
|
319
|
+
* of nodes present in the object_info.json
|
|
320
|
+
*/
|
|
321
|
+
RUN_BASIC_CHECKS = (): void => {
|
|
322
|
+
const numNodesInSource = Object.keys(this.data.spec).length
|
|
323
|
+
// +1: the injected UnknownNodeXX default schema
|
|
324
|
+
const numNodesInSchema = this.nodes.length - 1
|
|
325
|
+
if (numNodesInSource !== numNodesInSchema) {
|
|
326
|
+
console.log(`🔴 parsed ${numNodesInSchema} nodes but object_info has ${numNodesInSource}`)
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
hasEmbedding(embedding: string): embedding is EmbeddingName {
|
|
331
|
+
return this.data.embeddings.includes(embedding)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
hasLora(loraName: string): boolean {
|
|
335
|
+
return this.getLoras().includes(loraName)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** all loras on the host, optionally narrowed by a regex */
|
|
339
|
+
getLoras = (filter?: RegExp): string[] => {
|
|
340
|
+
const all = this.stringValues('LoraLoader.lora_name')
|
|
341
|
+
return filter == null ? all : all.filter((n) => filter.test(n))
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
hasImage(imgName: string): imgName is ComfyImageName {
|
|
345
|
+
return this.getImages().includes(imgName)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
getImages = (): string[] => {
|
|
349
|
+
return this.stringValues('LoadImage.image')
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* only use this function after an upload success,
|
|
354
|
+
* when you say this asset is now part of ComfyUI
|
|
355
|
+
**/
|
|
356
|
+
unsafely_addImageInSchemaWithoutReloading = (imgName: ComfyImageName): void => {
|
|
357
|
+
const enumInfo = this.knownUnionBySlotName.get(asComfyNodeSlotName('LoadImage.image'))
|
|
358
|
+
if (enumInfo == null) throw new Error(`LoadImage.image not found`)
|
|
359
|
+
enumInfo.values.push(imgName)
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
hasCheckpoint(ckptName: string): boolean {
|
|
363
|
+
return this.getCheckpoints().includes(ckptName)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
getCheckpoints = (): string[] => {
|
|
367
|
+
return this.stringValues('CheckpointLoaderSimple.ckpt_name')
|
|
368
|
+
}
|
|
369
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { scope, type } from 'arktype'
|
|
2
|
+
|
|
3
|
+
export const ComfyUIObjectInfoScope = scope({
|
|
4
|
+
ComfySchemaJSON: { '[string]': 'ComfyNodeSchemaJSON' },
|
|
5
|
+
ComfyNodeSchemaJSON: {
|
|
6
|
+
input: {
|
|
7
|
+
'required?': { '[string]': 'ComfyInputSpec' },
|
|
8
|
+
'optional?': { '[string]': 'ComfyInputSpec' },
|
|
9
|
+
'hidden?': { '[string]': 'ComfyInputHiddenEntry' },
|
|
10
|
+
},
|
|
11
|
+
'input_order?': {
|
|
12
|
+
'required?': 'string[]',
|
|
13
|
+
'optional?': 'string[]',
|
|
14
|
+
'hidden?': 'string[]',
|
|
15
|
+
},
|
|
16
|
+
output: 'ComfyInputType[]',
|
|
17
|
+
output_is_list: 'boolean[]',
|
|
18
|
+
output_name: 'string[]',
|
|
19
|
+
name: 'string',
|
|
20
|
+
display_name: 'string',
|
|
21
|
+
description: 'string',
|
|
22
|
+
/** */
|
|
23
|
+
python_module: 'string',
|
|
24
|
+
category: 'string',
|
|
25
|
+
output_node: 'boolean',
|
|
26
|
+
'output_tooltips?': 'string[]',
|
|
27
|
+
// Stability Flags
|
|
28
|
+
'deprecated?': 'boolean',
|
|
29
|
+
'experimental?': 'boolean',
|
|
30
|
+
},
|
|
31
|
+
ComfyInputSpecAlt1: ['ComfyInputType', 'ComfyInputOpts'],
|
|
32
|
+
ComfyInputSpecAlt2: ['ComfyInputType'],
|
|
33
|
+
// means it's broken: some nodes declare an input whose spec is literally
|
|
34
|
+
// [null] — accepted here so ONE bad node cannot fail a whole schema parse
|
|
35
|
+
ComfyInputSpecAlt3: type([type.null]),
|
|
36
|
+
ComfyInputSpec: `ComfyInputSpecAlt1 | ComfyInputSpecAlt2 | ComfyInputSpecAlt3`,
|
|
37
|
+
|
|
38
|
+
ComfyInputType: `string | ComfyEnumDef`,
|
|
39
|
+
|
|
40
|
+
ComfyInputHiddenEntry_broken1: '"CHOOSE"[][]', // BROKEN STUFF (e.g. found in several 'rgthree' nodes)
|
|
41
|
+
ComfyInputHiddenEntry_broken2: type.Record('string', type.unknown), // BROKEN STUFF (e.g. found in "ttN xyPlot")
|
|
42
|
+
ComfyInputHiddenEntry: 'string | ComfyInputHiddenEntry_broken1 | ComfyInputHiddenEntry_broken2 ',
|
|
43
|
+
|
|
44
|
+
ComfyInputOpts_simple: 'string',
|
|
45
|
+
ComfyInputOpts_advanced: {
|
|
46
|
+
// 💬 2025-06-11 rvion: "ComfyInputOpts_advanced" added because of Segment.input.optional.background : Segment.input.optional.background[1].tooltip must be a string or null (was an object) or Segment.input.optional.background must be exactly length 1 (was 2)
|
|
47
|
+
'tooltip?': 'string | null | ComfyInputOpts_advanced',
|
|
48
|
+
'multiline?': 'boolean | null',
|
|
49
|
+
|
|
50
|
+
// 💬 2025-06-11 rvion: "number[]" added because of CreateShapeImageOnPath.input.optional.size_multiplier : CreateShapeImageOnPath.input.optional.size_multiplier[1].default must be a number, a string, boolean or null (was an object) or CreateShapeImageOnPath.input.optional.size_multiplier must be exactly length 1 (was 2)
|
|
51
|
+
'default?': 'boolean | number | string | null | number[]',
|
|
52
|
+
|
|
53
|
+
'forceInput?': 'boolean | null',
|
|
54
|
+
'min?': 'number | null',
|
|
55
|
+
'round?': 'boolean | number | null',
|
|
56
|
+
'max?': 'number | null',
|
|
57
|
+
'step?': 'number | null',
|
|
58
|
+
/** Observed on 2024-11-01; 171 occurrences */
|
|
59
|
+
'dynamicPrompts?': 'boolean',
|
|
60
|
+
|
|
61
|
+
/** text widgets (e.g. LoraManager autocomplete fields) */
|
|
62
|
+
'placeholder?': 'string | null',
|
|
63
|
+
|
|
64
|
+
/** COMBO-typed inputs (ComfyUI ≥ 0.3.x) carry their choices here */
|
|
65
|
+
'options?': 'unknown[] | null',
|
|
66
|
+
'multiselect?': 'boolean | null',
|
|
67
|
+
|
|
68
|
+
// 💬 2025-06-11 rvion: "0" added because of CustomControlNetWeightsFluxFromList.input.optional.autosize : CustomControlNetWeightsFluxFromList.input.optional.autosize[1].padding must be boolean (was 0) or CustomControlNetWeightsFluxFromList.input.optional.autosize must be exactly length 1 (was 2)
|
|
69
|
+
'padding?': 'boolean | 0',
|
|
70
|
+
},
|
|
71
|
+
ComfyInputOpts: 'ComfyInputOpts_simple | ComfyInputOpts_advanced',
|
|
72
|
+
|
|
73
|
+
ComfyEnumIllustratedItem: {
|
|
74
|
+
content: 'string',
|
|
75
|
+
'image?': 'string | null',
|
|
76
|
+
},
|
|
77
|
+
ComfyEnumItem: 'string | number | boolean | ComfyEnumIllustratedItem',
|
|
78
|
+
ComfyEnumDef: `ComfyEnumItem[]`,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const types = ComfyUIObjectInfoScope.export()
|
|
82
|
+
|
|
83
|
+
export type ComfySchemaJSON = typeof types.ComfySchemaJSON.infer
|
|
84
|
+
export type ComfyNodeSchemaJSON = typeof types.ComfyNodeSchemaJSON.infer
|
|
85
|
+
export type ComfyInputSpec = typeof types.ComfyInputSpec.infer
|
|
86
|
+
export type ComfyInputType = typeof types.ComfyInputType.infer
|
|
87
|
+
export type ComfyEnumDef = typeof types.ComfyEnumDef.infer
|
|
88
|
+
export type ComfyInputOpts = typeof types.ComfyInputOpts.infer
|
|
89
|
+
|
|
90
|
+
export const ComfySchemaJSON_ark = types.ComfySchemaJSON
|
|
91
|
+
export const ComfyNodeSchemaJSON_ark = types.ComfyNodeSchemaJSON
|
|
92
|
+
export const ComfyInputSpec_ark = types.ComfyInputSpec
|
|
93
|
+
export const ComfyInputType_ark = types.ComfyInputType
|
|
94
|
+
export const ComfyEnumDef_ark = types.ComfyEnumDef
|
|
95
|
+
export const ComfyInputOpts_ark = types.ComfyInputOpts
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { LiteGraphNode } from 'src/litegraph/LiteGraphNode.ts'
|
|
2
|
+
import type { ComfyNodeSchemaJSON } from 'src/sdk-generator/ComfyUIObjectInfoTypes.ts'
|
|
3
|
+
import type { NodeInputExt } from 'src/sdk-generator/comfyui-types.ts'
|
|
4
|
+
|
|
5
|
+
export const ComfyPrimitiveMapping: { [key: string]: string } = {
|
|
6
|
+
// BACK
|
|
7
|
+
BOOLEAN: 'boolean',
|
|
8
|
+
FLOAT: 'number',
|
|
9
|
+
INT: 'number',
|
|
10
|
+
STRING: 'string',
|
|
11
|
+
|
|
12
|
+
// ????
|
|
13
|
+
// ⏸️ Boolean: 'boolean',
|
|
14
|
+
// ⏸️ Float: 'number',
|
|
15
|
+
// ⏸️ Integer: 'number',
|
|
16
|
+
// ⏸️ SchedulerName: 'string',
|
|
17
|
+
// ⏸️ SamplerName: 'string',
|
|
18
|
+
// ⏸️ IMAGE_PATH: 'string',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const ComfyPrimitives: string[] = Object.keys(ComfyPrimitiveMapping)
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* when a litegraph node has no input for a given ComfyUI node input
|
|
25
|
+
* (e.g. a seed or an enum that has not been turned into a primitive)
|
|
26
|
+
*/
|
|
27
|
+
export const howManyWidgetValuesForThisSchemaType = (input: NodeInputExt): number => {
|
|
28
|
+
if (input.typeName === 'INT') {
|
|
29
|
+
if (input.nameInComfy === 'seed' || input.nameInComfy === 'noise_seed') return 2
|
|
30
|
+
}
|
|
31
|
+
if (input.isPrimitive) return 1
|
|
32
|
+
// 🔴
|
|
33
|
+
if (input.typeName.startsWith('E_')) return 1
|
|
34
|
+
// console.log(343, input)
|
|
35
|
+
return 0
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* then a litegraph node has an input entry, some convoluted logic seems to be necessary
|
|
40
|
+
* to determine how many Field_values need to be consumed for this input
|
|
41
|
+
*/
|
|
42
|
+
export const howManyWidgetValuesForThisInputType = (type: string, nameInComfy: string): number => {
|
|
43
|
+
if (type === 'INT') {
|
|
44
|
+
if (nameInComfy === 'seed' || nameInComfy === 'noise_seed') return 2
|
|
45
|
+
return 1
|
|
46
|
+
}
|
|
47
|
+
if (type === 'BOOLEAN') return 1
|
|
48
|
+
if (type === 'FLOAT') return 1
|
|
49
|
+
if (type === 'STRING') return 1
|
|
50
|
+
if (type === 'COMBO') return 1
|
|
51
|
+
if (type === 'INT:seed') return 2
|
|
52
|
+
if (type === 'INT:noise_seed') return 2
|
|
53
|
+
|
|
54
|
+
// not a primitive, no Field_values
|
|
55
|
+
return 0
|
|
56
|
+
}
|
|
57
|
+
export const ComfyDefaultNodeWhenUnknown_Name: string = 'UnknownNodeXX'
|
|
58
|
+
|
|
59
|
+
export const ComfyDefaultNodeWhenUnknown_Schema: ComfyNodeSchemaJSON = {
|
|
60
|
+
category: 'test',
|
|
61
|
+
input: {},
|
|
62
|
+
output: [],
|
|
63
|
+
description: 'This is a test node',
|
|
64
|
+
output_name: [],
|
|
65
|
+
display_name: 'UnknownNodeXX',
|
|
66
|
+
name: 'UnknownNodeXX',
|
|
67
|
+
output_is_list: [],
|
|
68
|
+
output_node: false,
|
|
69
|
+
python_module: 'nodes',
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export class UnknownCustomNode extends Error {
|
|
73
|
+
constructor(public node: LiteGraphNode) {
|
|
74
|
+
super(`❌ node ${node.id}(${node.type}) has no known schema; you probably need to install some custom node`)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** having a bunch of sensible default will help slightly */
|
|
2
|
+
export function getUnionNameBasedOnFirstFoundEnumName(
|
|
3
|
+
//
|
|
4
|
+
enumName: string,
|
|
5
|
+
hash: string,
|
|
6
|
+
hashContent: string,
|
|
7
|
+
): string {
|
|
8
|
+
// core enums
|
|
9
|
+
if (enumName === 'KSampler.sampler_name') return 'E_SamplerName'
|
|
10
|
+
if (enumName === 'KSampler.scheduler') return 'E_SchedulerName'
|
|
11
|
+
if (enumName === 'CheckpointLoaderSimple.ckpt_name') return 'E_CkptName'
|
|
12
|
+
if (enumName === 'VAELoader.vae_name') return 'E_VaeName'
|
|
13
|
+
if (enumName === 'LoraLoader.lora_name') return 'E_LoraName'
|
|
14
|
+
// upscape methods
|
|
15
|
+
if (enumName === 'LatentUpscale.upscale_method') return 'E_LatentUpscaleMethod'
|
|
16
|
+
if (enumName === 'ImageScale.upscale_method') return 'E_ImageUpscaleMethod'
|
|
17
|
+
// core objects
|
|
18
|
+
if (enumName === 'LoadImage.image') return 'E_Image'
|
|
19
|
+
if (enumName === 'LoadImageMask.channel') return 'E_Channel'
|
|
20
|
+
// misc
|
|
21
|
+
if (enumName === 'KSamplerAdvanced.add_noise') return 'E_EnableOrDisable'
|
|
22
|
+
if (enumName === 'LatentRotate.rotation') return 'E_Rotation'
|
|
23
|
+
if (enumName === 'LatentFlip.flip_method') return 'E_FlipMethod'
|
|
24
|
+
if (enumName === 'CLIPLoader.type') return 'E_ClipType'
|
|
25
|
+
if (enumName === 'UNETLoader.weight_dtype') return 'E_WeightDType'
|
|
26
|
+
if (enumName === 'DualCLIPLoader.type') return 'E_DualClipType'
|
|
27
|
+
if (enumName === 'CheckpointLoader.config_name') return 'E_CkptConfigName'
|
|
28
|
+
|
|
29
|
+
// civitai_comfy_nodes
|
|
30
|
+
if (enumName === 'civitai_comfy_nodes.CivitAI_Checkpoint_Loader.ckpt_name') return 'E_CivitAICkptName'
|
|
31
|
+
|
|
32
|
+
// Impact-Specific
|
|
33
|
+
if (enumName === 'Impact-Pack.SAMDetectorCombined.detection_hint') return 'E_ImpactDetectionHint'
|
|
34
|
+
|
|
35
|
+
// Misc
|
|
36
|
+
if (hashContent === 'false|true') return 'E_TrueOrFalse'
|
|
37
|
+
if (hashContent === 'CPU|GPU') return 'E_CpuOrGpu'
|
|
38
|
+
return 'E_' + hash
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function pythonModuleToPrefix(pythonModule: string): string {
|
|
2
|
+
// if (pythonModule == null) console.error(`[🔴🔴🔴🔴🔴🔴] `, pythonModule)
|
|
3
|
+
if (pythonModule === 'nodes') return ''
|
|
4
|
+
if (pythonModule.startsWith('comfy_extras.')) return '' //''
|
|
5
|
+
if (pythonModule.startsWith('comfy_api_nodes.')) return pythonModule.replace('comfy_api_nodes.', 'api.')
|
|
6
|
+
if (pythonModule.startsWith('custom_nodes.')) {
|
|
7
|
+
// return `${pythonModuleToNamespace_(pythonModule.replace('custom_nodes.', ''))}.`
|
|
8
|
+
return (
|
|
9
|
+
pythonModule //
|
|
10
|
+
// remove always present "custom_nodes." prefix
|
|
11
|
+
.replace(/^custom_nodes\./i, '')
|
|
12
|
+
// remove common ~comfyui prefixes and suffixes
|
|
13
|
+
.replace(/^comfyui[-_]/i, '')
|
|
14
|
+
.replace(/[-_]comfyui$/i, '')
|
|
15
|
+
// remove common ~comfy prefixes and suffixes
|
|
16
|
+
.replace(/^comfy[-_]/i, '')
|
|
17
|
+
.replace(/[-_]comfy$/i, '')
|
|
18
|
+
// remove common ~nodes prefixes and suffixes
|
|
19
|
+
.replace(/^nodes[-_]/i, '')
|
|
20
|
+
.replace(/[-_]node[-_]suite$/i, '') + '.'
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
// unknown module layout: fall back to a sanitized module prefix instead of
|
|
24
|
+
// crashing the whole codegen because of one unusual custom node
|
|
25
|
+
console.warn(`[comfy-ts] unexpected pythonModule "${pythonModule}", using it as prefix as-is`)
|
|
26
|
+
return `${pythonModule}.`
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* the graph format comfyUI server takes as input
|
|
3
|
+
*
|
|
4
|
+
* !! Hasn't been updated in a while; may be out of date !!
|
|
5
|
+
*/
|
|
6
|
+
export type ComfyApiJson = {
|
|
7
|
+
[nodeUID: string]: ComfyApiNodeJson
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ComfyApiNodeJson = {
|
|
11
|
+
inputs: {
|
|
12
|
+
// prettier-ignore
|
|
13
|
+
[key: string]: [string, number] | string | number | boolean | null
|
|
14
|
+
}
|
|
15
|
+
class_type: string
|
|
16
|
+
}
|