comfy-ts 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ServeApp-BSA5yzxZ.js → ServeApp-qXcQfdgT.js} +3 -3
- package/dist/ServeApp-qXcQfdgT.js.map +1 -0
- package/dist/cli.js +58 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +956 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1154 -408
- package/dist/index.d.ts +1154 -408
- package/dist/index.js +956 -151
- package/dist/index.js.map +1 -1
- package/dist/{run-run-DnaMLCFn.js → run-run-Wn7H72Zg.js} +3 -3
- package/dist/{run-run-DnaMLCFn.js.map → run-run-Wn7H72Zg.js.map} +1 -1
- package/dist/{run-serve-CbKxIu6i.js → run-serve-DaXzoVTS.js} +58 -12
- package/dist/run-serve-DaXzoVTS.js.map +1 -0
- package/dist/{run-tui-B0AQWbad.js → run-tui-VWSj1D_j.js} +3 -3
- package/dist/{run-tui-B0AQWbad.js.map → run-tui-VWSj1D_j.js.map} +1 -1
- package/dist/serve-web.js +56 -48
- package/dist/{state-C2oDiQ26.js → state-DgwWhZWb.js} +957 -152
- package/dist/state-DgwWhZWb.js.map +1 -0
- package/dist/web.d.ts +1172 -426
- package/dist/web.js +956 -151
- 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/cli/bunHop.ts +49 -0
- package/src/cli/comfy-ts-cli.ts +4 -4
- package/src/cli/serve/run-serve.ts +51 -13
- package/src/cli/serve/web/components/App.tsx +2 -0
- package/src/cli/serve/web/components/DialogLayer.tsx +55 -0
- package/src/cli/serve/web/components/DraftTabs.tsx +8 -3
- package/src/cli/serve/web/components/PromptEnhancer.tsx +15 -9
- package/src/cli/serve/web/components/SideMenu.tsx +16 -8
- package/src/cli/serve/web/state/WebSt.ts +10 -1
- package/src/cli/serve/web/state/dialog.ts +59 -0
- package/src/cli/serve/web/state/keptLines.ts +1 -1
- package/src/cli/serve/web/styles.ts +8 -0
- package/src/graph/ComfyNode.ts +93 -12
- package/src/host/ComfyHost.ts +31 -10
- package/src/host/ComfyManager.ts +448 -62
- 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 +127 -34
- package/src/litegraph/expandSubgraphs.ts +14 -0
- package/src/litegraph/normalizeWorkflow.ts +1 -0
- 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 +176 -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/promptEnhancers.ts +1 -1
- 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 +141 -33
- package/dist/ServeApp-BSA5yzxZ.js.map +0 -1
- package/dist/run-serve-CbKxIu6i.js.map +0 -1
- package/dist/state-C2oDiQ26.js.map +0 -1
package/src/graph/ComfyNode.ts
CHANGED
|
@@ -9,13 +9,14 @@ import {
|
|
|
9
9
|
containerInstanceSlotType,
|
|
10
10
|
defaultValueForWidget,
|
|
11
11
|
} from 'src/sdk-generator/inputWidgetKind.ts'
|
|
12
|
-
import type { DynamicComboOption } from 'src/sdk-generator/inputWidgetKind.ts'
|
|
12
|
+
import type { DynamicComboOption, RawInputSpecEntry } from 'src/sdk-generator/inputWidgetKind.ts'
|
|
13
13
|
import type { Maybe } from 'src/types/index.ts'
|
|
14
14
|
import { comfyColors } from 'src/utils/ComfyColors.ts'
|
|
15
15
|
import { auto_ } from 'src/graph/autoValue.ts'
|
|
16
16
|
import type { ComfyNodeId, ComfyNodeMetadata } from 'src/graph/ComfyNodeID.ts'
|
|
17
17
|
import { ComfyNodeOutput } from 'src/graph/ComfyNodeOutput.ts'
|
|
18
18
|
import { NodeSlotSize, NodeTitleHeight, nodeLineHeight } from 'src/graph/NodeSlotSize.ts'
|
|
19
|
+
import { exhaust } from 'src/utils/exhaust.ts'
|
|
19
20
|
|
|
20
21
|
type NodeExecutionStatus = 'executing' | 'done' | 'error' | 'waiting' | 'cached' | null
|
|
21
22
|
|
|
@@ -185,21 +186,39 @@ export class ComfyNode<
|
|
|
185
186
|
_convertPromptExtToPrompt(promptExt: ComfyApiNodeJson): ComfyApiNodeJson {
|
|
186
187
|
const inputs: { [inputName: string]: any } = {}
|
|
187
188
|
const _done = new Set<string>()
|
|
188
|
-
/** every dotted key
|
|
189
|
+
/** every dotted key a dynamic input wrote or dropped on purpose: the rest loop skips them */
|
|
189
190
|
const _comboBranchKeys = new Set<string>()
|
|
190
191
|
for (const i of this.$schema.inputs) {
|
|
191
192
|
_done.add(i.nameInComfy)
|
|
192
193
|
const kind = classifySchemaInput(i)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
switch (kind.kind) {
|
|
195
|
+
case 'dynamic-combo':
|
|
196
|
+
this._writeDynamicCombo({
|
|
197
|
+
name: i.nameInComfy,
|
|
198
|
+
options: kind.options,
|
|
199
|
+
defaultKey: kind.defaultKey,
|
|
200
|
+
provided: promptExt.inputs,
|
|
201
|
+
out: inputs,
|
|
202
|
+
claimed: _comboBranchKeys,
|
|
203
|
+
})
|
|
204
|
+
continue
|
|
205
|
+
case 'dynamic-group':
|
|
206
|
+
this._writeDynamicGroup({
|
|
207
|
+
name: i.nameInComfy,
|
|
208
|
+
fields: kind.fields,
|
|
209
|
+
min: kind.min,
|
|
210
|
+
max: kind.max,
|
|
211
|
+
provided: promptExt.inputs,
|
|
212
|
+
out: inputs,
|
|
213
|
+
claimed: _comboBranchKeys,
|
|
214
|
+
})
|
|
215
|
+
continue
|
|
216
|
+
case 'widget':
|
|
217
|
+
case 'slot':
|
|
218
|
+
case 'dynamic-container':
|
|
219
|
+
break
|
|
220
|
+
default:
|
|
221
|
+
exhaust(kind)
|
|
203
222
|
}
|
|
204
223
|
const value = this.serializeValue(i.nameInComfy, promptExt.inputs[i.nameInComfy])
|
|
205
224
|
// absent optionals (autogrow containers included) stay OUT of the
|
|
@@ -253,6 +272,61 @@ export class ComfyNode<
|
|
|
253
272
|
}
|
|
254
273
|
}
|
|
255
274
|
|
|
275
|
+
/** dynamic group → the row array becomes `<decl>.<row>.<field>` keys, absent fields filled
|
|
276
|
+
* from the schema (architecture.md, dynamic group). No array = a prompt json whose dotted
|
|
277
|
+
* keys are already the rows: they pass through the rest loop untouched */
|
|
278
|
+
private _writeDynamicGroup(p: {
|
|
279
|
+
name: string
|
|
280
|
+
fields: RawInputSpecEntry[]
|
|
281
|
+
min: number
|
|
282
|
+
max: number
|
|
283
|
+
provided: { [k: string]: unknown }
|
|
284
|
+
out: { [k: string]: any }
|
|
285
|
+
claimed: Set<string>
|
|
286
|
+
}): void {
|
|
287
|
+
const where = `${this.$schema.nodeKey}#${this.uid}`
|
|
288
|
+
const raw = p.provided[p.name]
|
|
289
|
+
const prefix = `${p.name}.`
|
|
290
|
+
if (raw == null) {
|
|
291
|
+
const hasRows = Object.keys(p.provided).some((k) => k.startsWith(prefix))
|
|
292
|
+
if (!hasRows && p.min > 0)
|
|
293
|
+
this.graph.recordProblem(`🔴 "${p.name}" on ${where} needs at least ${p.min} row(s)`)
|
|
294
|
+
return
|
|
295
|
+
}
|
|
296
|
+
// the array wins over stray dotted keys of the same group
|
|
297
|
+
for (const k of Object.keys(p.provided)) if (k.startsWith(prefix)) p.claimed.add(k)
|
|
298
|
+
if (!Array.isArray(raw)) {
|
|
299
|
+
this.graph.recordProblem(`🔴 "${p.name}" on ${where} takes an array of rows, got ${JSON.stringify(raw)}`)
|
|
300
|
+
return
|
|
301
|
+
}
|
|
302
|
+
if (raw.length < p.min || raw.length > p.max)
|
|
303
|
+
this.graph.recordProblem(
|
|
304
|
+
`🔴 "${p.name}" on ${where} has ${raw.length} row(s), the host takes ${p.min} to ${p.max}`,
|
|
305
|
+
)
|
|
306
|
+
raw.forEach((row: unknown, ix) => {
|
|
307
|
+
if (typeof row !== 'object' || row == null || Array.isArray(row)) {
|
|
308
|
+
this.graph.recordProblem(`🔴 "${p.name}" row ${ix} on ${where} is not an object: ${JSON.stringify(row)}`)
|
|
309
|
+
return
|
|
310
|
+
}
|
|
311
|
+
const given = new Map(Object.entries(row))
|
|
312
|
+
for (const field of p.fields) {
|
|
313
|
+
const dotted = `${p.name}.${ix}.${field.name}`
|
|
314
|
+
const value = given.get(field.name)
|
|
315
|
+
p.out[dotted] =
|
|
316
|
+
value == null
|
|
317
|
+
? defaultValueForWidget({
|
|
318
|
+
type: typeof field.type === 'string' ? field.type : 'COMBO',
|
|
319
|
+
opts: field.opts,
|
|
320
|
+
enumValues: Array.isArray(field.type) ? field.type.filter(isScalarValue) : undefined,
|
|
321
|
+
})
|
|
322
|
+
: this.serializeValue(dotted, value)
|
|
323
|
+
given.delete(field.name)
|
|
324
|
+
}
|
|
325
|
+
for (const extra of given.keys())
|
|
326
|
+
this.graph.recordProblem(`🔴 "${p.name}" row ${ix} on ${where} has no field "${extra}"`)
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
|
|
256
330
|
/** return the list of nodes piped into this node */
|
|
257
331
|
_incomingNodes(): ComfyNodeId[] {
|
|
258
332
|
const incomingNodes: ComfyNodeId[] = []
|
|
@@ -454,6 +528,13 @@ export class ComfyNode<
|
|
|
454
528
|
const slotType = containerInstanceSlotType(decl.opts)
|
|
455
529
|
if (kind.kind === 'dynamic-container' && kind.instanceNames.includes(name.slice(dot + 1)) && slotType != null)
|
|
456
530
|
return slotType
|
|
531
|
+
// dynamic group row field `decl.<row>.<field>`: the template field carries the type
|
|
532
|
+
if (kind.kind === 'dynamic-group') {
|
|
533
|
+
const rest = name.slice(dot + 1)
|
|
534
|
+
const fieldName = rest.slice(rest.indexOf('.') + 1)
|
|
535
|
+
const field = kind.fields.find((f) => f.name === fieldName)
|
|
536
|
+
if (rest.includes('.') && typeof field?.type === 'string') return field.type
|
|
537
|
+
}
|
|
457
538
|
}
|
|
458
539
|
throw new Error(
|
|
459
540
|
`🔴 no input "${name}" on ${this.$schema.nodeKey}: cannot tell which output of the linked node to use`,
|
package/src/host/ComfyHost.ts
CHANGED
|
@@ -24,6 +24,8 @@ import {
|
|
|
24
24
|
type PromptRelated_WsMsg,
|
|
25
25
|
type WsMsg,
|
|
26
26
|
WsMsg_ark,
|
|
27
|
+
isIgnoredWsEventType,
|
|
28
|
+
isRoutedWsEventType,
|
|
27
29
|
WsMsgLogsData_ark,
|
|
28
30
|
} from 'src/runner/ComfyWsApi.ts'
|
|
29
31
|
import { ComfySchema } from 'src/sdk-generator/ComfySchema.ts'
|
|
@@ -848,8 +850,10 @@ export class ComfyHost<ID extends string = string> {
|
|
|
848
850
|
/** the session assigned to us by the server */
|
|
849
851
|
comfySessionId: string = 'temp' /** send by ComfyUI server */
|
|
850
852
|
|
|
851
|
-
/**
|
|
853
|
+
/** event types we already complained about on this connection (one log per type, no
|
|
854
|
+
* spam); both sets clear when the server assigns a new session id */
|
|
852
855
|
private _unknownBinaryFrameTypes = new Set<number>()
|
|
856
|
+
private _unknownWsEventTypes = new Set<string>()
|
|
853
857
|
|
|
854
858
|
/** handy to keep around */
|
|
855
859
|
status: ComfyStatusData['status'] | null = null
|
|
@@ -919,11 +923,27 @@ export class ComfyHost<ID extends string = string> {
|
|
|
919
923
|
return
|
|
920
924
|
}
|
|
921
925
|
|
|
922
|
-
|
|
926
|
+
let msg_: unknown = JSON.parse(String(e.data))
|
|
927
|
+
|
|
928
|
+
// ----- routed, ignored by name, or unknown (architecture.md, ws events) -----
|
|
929
|
+
const rec = typeof msg_ === 'object' && msg_ != null ? msg_ : null
|
|
930
|
+
const eventType = rec != null && 'type' in rec && typeof rec.type === 'string' ? rec.type : null
|
|
931
|
+
if (eventType != null && isIgnoredWsEventType(eventType)) return
|
|
932
|
+
if (eventType == null || !isRoutedWsEventType(eventType)) {
|
|
933
|
+
const key = eventType ?? '<no type>'
|
|
934
|
+
if (this._unknownWsEventTypes.has(key)) return
|
|
935
|
+
this._unknownWsEventTypes.add(key)
|
|
936
|
+
console.error(
|
|
937
|
+
`🔴 unknown ws event type ${JSON.stringify(key)} from host ${this.data.id}, ignored (reported once per connection)`,
|
|
938
|
+
)
|
|
939
|
+
return
|
|
940
|
+
}
|
|
923
941
|
|
|
924
|
-
//
|
|
925
|
-
if (
|
|
926
|
-
|
|
942
|
+
// the reconnect resend of the running node carries no prompt_id (server.py websocket_handler)
|
|
943
|
+
if (eventType === 'executing' && this.activePromptID != null && rec != null) {
|
|
944
|
+
const data: unknown = Reflect.get(rec, 'data')
|
|
945
|
+
if (typeof data === 'object' && data != null && !('prompt_id' in data))
|
|
946
|
+
msg_ = { type: eventType, data: { ...data, prompt_id: this.activePromptID } }
|
|
927
947
|
}
|
|
928
948
|
|
|
929
949
|
// ----- soft-validate against the schema -----
|
|
@@ -942,7 +962,11 @@ export class ComfyHost<ID extends string = string> {
|
|
|
942
962
|
this.comfySessionId = msg.data.sid
|
|
943
963
|
this._sessionResolve?.()
|
|
944
964
|
this._sessionResolve = null
|
|
945
|
-
if (sidChanged)
|
|
965
|
+
if (sidChanged) {
|
|
966
|
+
this._unknownWsEventTypes.clear()
|
|
967
|
+
this._unknownBinaryFrameTypes.clear()
|
|
968
|
+
this.onSession?.(msg.data.sid)
|
|
969
|
+
}
|
|
946
970
|
}
|
|
947
971
|
this.status = msg.data.status
|
|
948
972
|
this.onStatus?.({ queueRemaining: msg.data.status?.exec_info?.queue_remaining ?? 0 })
|
|
@@ -963,6 +987,7 @@ export class ComfyHost<ID extends string = string> {
|
|
|
963
987
|
msg.type === 'execution_start' ||
|
|
964
988
|
msg.type === 'execution_cached' ||
|
|
965
989
|
msg.type === 'execution_error' ||
|
|
990
|
+
msg.type === 'execution_interrupted' ||
|
|
966
991
|
msg.type === 'execution_success' ||
|
|
967
992
|
msg.type === 'executing' ||
|
|
968
993
|
msg.type === 'executed' ||
|
|
@@ -982,9 +1007,5 @@ export class ComfyHost<ID extends string = string> {
|
|
|
982
1007
|
return
|
|
983
1008
|
}
|
|
984
1009
|
exhaust(msg)
|
|
985
|
-
console.log('❌', 'Unknown message:', msg)
|
|
986
|
-
|
|
987
|
-
toastError('Unknown message type: ' + JSON.stringify(msg.type))
|
|
988
|
-
// throw new Error('Unknown message type: ' + JSON.stringify(msg))
|
|
989
1010
|
}
|
|
990
1011
|
}
|