comfy-ts 2.17.1 → 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.
Files changed (80) hide show
  1. package/dist/cli.js +3 -3
  2. package/dist/index.cjs +944 -165
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1154 -408
  5. package/dist/index.d.ts +1154 -408
  6. package/dist/index.js +944 -165
  7. package/dist/index.js.map +1 -1
  8. package/dist/{run-run-tg82jUIk.js → run-run-Wn7H72Zg.js} +2 -2
  9. package/dist/{run-run-tg82jUIk.js.map → run-run-Wn7H72Zg.js.map} +1 -1
  10. package/dist/{run-tui-Bw7BA75d.js → run-tui-VWSj1D_j.js} +2 -2
  11. package/dist/{run-tui-Bw7BA75d.js.map → run-tui-VWSj1D_j.js.map} +1 -1
  12. package/dist/serve-web.js +47 -47
  13. package/dist/{state-zTow5ucI.js → state-DgwWhZWb.js} +945 -166
  14. package/dist/state-DgwWhZWb.js.map +1 -0
  15. package/dist/web.d.ts +1172 -426
  16. package/dist/web.js +944 -165
  17. package/dist/web.js.map +1 -1
  18. package/examples/comfy-cloud/ace-step15-t2a.cflow.ts +163 -0
  19. package/examples/comfy-cloud/anima-t2i-base.cflow.ts +57 -0
  20. package/examples/comfy-cloud/boogu-t2i.cflow.ts +55 -0
  21. package/examples/comfy-cloud/chronoedit-i2i.cflow.ts +95 -0
  22. package/examples/comfy-cloud/ernie-t2i-base.cflow.ts +81 -0
  23. package/examples/comfy-cloud/flux1-t2i-krea.cflow.ts +63 -0
  24. package/examples/comfy-cloud/flux2-i2i-dev.cflow.ts +83 -0
  25. package/examples/comfy-cloud/flux2-t2i-dev.cflow.ts +60 -0
  26. package/examples/comfy-cloud/hidream-o1-i2i.cflow.ts +71 -0
  27. package/examples/comfy-cloud/hidream-o1-t2i.cflow.ts +62 -0
  28. package/examples/comfy-cloud/krea2-i2i.cflow.ts +78 -0
  29. package/examples/comfy-cloud/ltx2-i2v.cflow.ts +175 -0
  30. package/examples/comfy-cloud/ltx2-t2v.cflow.ts +143 -0
  31. package/examples/comfy-cloud/ltx23-i2v.cflow.ts +189 -0
  32. package/examples/comfy-cloud/ltx23-t2v.cflow.ts +151 -0
  33. package/examples/comfy-cloud/mage-flow-i2i-turbo.cflow.ts +72 -0
  34. package/examples/comfy-cloud/mage-flow-i2i.cflow.ts +74 -0
  35. package/examples/comfy-cloud/mage-flow-t2i-turbo.cflow.ts +60 -0
  36. package/examples/comfy-cloud/mage-flow-t2i.cflow.ts +60 -0
  37. package/examples/comfy-cloud/minimax-h3-t2i.cflow.ts +64 -0
  38. package/examples/comfy-cloud/netayume-t2i.cflow.ts +60 -0
  39. package/examples/comfy-cloud/qwen-image-i2i-2509.cflow.ts +75 -0
  40. package/examples/comfy-cloud/qwen-image-t2i-2512.cflow.ts +63 -0
  41. package/examples/comfy-cloud/sdk.d.ts +21683 -13737
  42. package/examples/comfy-cloud/stable-audio3-t2a.cflow.ts +96 -0
  43. package/examples/comfy-cloud/z-image-t2i-base.cflow.ts +54 -0
  44. package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +1 -1
  45. package/package.json +2 -2
  46. package/src/graph/ComfyNode.ts +93 -12
  47. package/src/host/ComfyHost.ts +31 -10
  48. package/src/host/ComfyManager.ts +448 -62
  49. package/src/litegraph/CanonicalWorkflow.ts +3 -0
  50. package/src/litegraph/LiteGraphJSON.ts +2 -2
  51. package/src/litegraph/LiteGraphNodeInput.ts +2 -2
  52. package/src/litegraph/LiteGraphNodeOutput.ts +2 -2
  53. package/src/litegraph/convertFlowToLiteGraphJSON.ts +112 -37
  54. package/src/litegraph/expandSubgraphs.ts +14 -0
  55. package/src/litegraph/normalizeWorkflow.ts +1 -0
  56. package/src/manager/ComfyRegistry.ts +2 -0
  57. package/src/manager/generated/KnownComfyCustomNodeName.ts +6354 -1680
  58. package/src/manager/generated/KnownComfyPluginTitle.ts +718 -356
  59. package/src/manager/generated/KnownComfyPluginURL.ts +357 -181
  60. package/src/manager/generated/KnownModel_Base.ts +9 -5
  61. package/src/manager/generated/KnownModel_FileName.ts +135 -0
  62. package/src/manager/generated/KnownModel_Name.ts +135 -0
  63. package/src/manager/generated/KnownModel_SavePath.ts +16 -14
  64. package/src/manager/generated/KnownModel_Type.ts +15 -13
  65. package/src/manager/installedView.ts +176 -0
  66. package/src/manager/json/custom-node-list.json +4018 -2248
  67. package/src/manager/json/extension-node-map.json +8903 -2964
  68. package/src/manager/json/github-stats.json +10796 -10036
  69. package/src/manager/json/model-list.json +298 -1
  70. package/src/manager/loaders/step4_model-list-loader.ts +1 -0
  71. package/src/manager/types/ComfyManagerAPIModelList.ts +3 -0
  72. package/src/manager/types/ComfyManagerAPIPluginList.ts +19 -0
  73. package/src/runner/ComfyExecution.ts +4 -1
  74. package/src/runner/ComfyWsApi.ts +82 -15
  75. package/src/sdk-generator/ComfySchema.ts +10 -1
  76. package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +4 -1
  77. package/src/sdk-generator/comfyui-sdk-codegen.ts +61 -20
  78. package/src/sdk-generator/inputWidgetKind.ts +19 -4
  79. package/src/sdk-generator/litegraphToApiRequestPayload.ts +141 -33
  80. package/dist/state-zTow5ucI.js.map +0 -1
@@ -0,0 +1,96 @@
1
+ // stable-audio3 t2a on Comfy Cloud — Stable Audio 3 Medium text to audio: music, instruments, sound effects or one-shots; distilled or base model
2
+ // source template: audio_stable_audio_3_medium.json (official workflow-templates), the base choice follows audio_stable_audio_3_medium_base.json
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // note: audio outputs PERSIST on the host (upstream ships no websocket saver for audio — image examples stream ephemerally)
5
+ // run directly: bun examples/comfy-cloud/stable-audio3-t2a.cflow.ts ["prompt"] [seed]
6
+ import { v } from 'comfy-ts'
7
+ // the template's four per-category system prompts, verbatim, shared with rvion 12 (the same model on the local box)
8
+ import { SA3_CATEGORIES, sa3Reprompt } from '../rvion/stableAudio3Prompts.ts'
9
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
10
+
11
+ const host = await cloudHost()
12
+
13
+ // each checkpoint with its own template's sampling: the distilled one runs 8 steps at cfg 1, the base one 50 at cfg 7
14
+ const MODELS = {
15
+ medium: { ckpt: 'stable_audio_3_medium.safetensors', steps: 8, cfg: 1 },
16
+ 'medium base': { ckpt: 'stable_audio_3_medium_base.safetensors', steps: 50, cfg: 7 },
17
+ } as const
18
+
19
+ export const stableAudio3T2a = host.defineWorkflow({
20
+ id: 'stable-audio3-t2a',
21
+ vars: {
22
+ // ONE prompt var: a plain description is enough when `reprompt` is on (`//` lines are comments)
23
+ prompt: v.prompt(
24
+ 'Tropical house track with marimba, steel drums, soft synths, smooth bass, layered percussion, and light piano riffs for sunny chill dance vibes',
25
+ ),
26
+ seed: v.seed(42),
27
+ model: v.choice(['medium', 'medium base'], 'medium', 'model'),
28
+ category: v.choice(SA3_CATEGORIES, 'Music', 'category'),
29
+ // on: a qwen3.5 2b first rewrites the description with the category's system prompt and the target length
30
+ reprompt: v.toggle(true, 'reprompt'),
31
+ seconds: v.float(150, { min: 1, max: 300 }),
32
+ },
33
+ build: (b, vars) => {
34
+ const m = MODELS[vars.model]
35
+ const ckpt = b.CheckpointLoaderSimple({ ckpt_name: m.ckpt })
36
+ const clip = b.CLIPLoader({ clip_name: 't5gemma_b_b_ul2.safetensors', type: 'stable_audio', device: 'default' })
37
+
38
+ const text = vars.reprompt
39
+ ? b.TextGenerate({
40
+ clip: b.CLIPLoader({
41
+ clip_name: 'qwen3.5_2b_bf16.safetensors',
42
+ type: 'stable_diffusion',
43
+ device: 'default',
44
+ }),
45
+ prompt: sa3Reprompt({
46
+ category: vars.category,
47
+ input: vars.prompt.positive,
48
+ seconds: Math.floor(vars.seconds),
49
+ }),
50
+ max_length: 256,
51
+ sampling_mode: 'on',
52
+ 'sampling_mode.temperature': 0.7,
53
+ 'sampling_mode.top_k': 64,
54
+ 'sampling_mode.top_p': 0.95,
55
+ 'sampling_mode.min_p': 0.05,
56
+ 'sampling_mode.repetition_penalty': 1.05,
57
+ 'sampling_mode.seed': 0,
58
+ thinking: false,
59
+ use_default_template: true,
60
+ mtp: 'auto',
61
+ }).outputs.generated_text
62
+ : vars.prompt.positive
63
+
64
+ // lcm sampling against an empty negative
65
+ const samples = b.KSampler({
66
+ model: ckpt.outputs.MODEL,
67
+ positive: b.CLIPTextEncode({ clip, text }),
68
+ negative: b.CLIPTextEncode({ clip, text: '' }),
69
+ latent_image: b.EmptyLatentAudio({ seconds: vars.seconds, batch_size: 1 }),
70
+ seed: vars.seed,
71
+ steps: m.steps,
72
+ cfg: m.cfg,
73
+ sampler_name: 'lcm',
74
+ scheduler: 'simple',
75
+ denoise: 1,
76
+ })
77
+ b.SaveAudioAdvanced({
78
+ audio: b.VAEDecodeAudio({ samples, vae: ckpt.outputs.VAE }),
79
+ filename_prefix: 'comfy-ts-zoo/stable-audio3-t2a',
80
+ format: 'mp3',
81
+ 'format.quality': 'V0',
82
+ })
83
+ },
84
+ })
85
+
86
+ export default stableAudio3T2a
87
+
88
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
89
+ if (import.meta.main) {
90
+ requireCloudKey()
91
+ if (process.argv[2]) stableAudio3T2a.vars.prompt.set(process.argv[2])
92
+ if (process.argv[3]) stableAudio3T2a.vars.seed.set(Number(process.argv[3]))
93
+ const execution = await stableAudio3T2a.run({ log: true, save: { prefix: 'comfy-ts-zoo/stable-audio3-t2a' } })
94
+ for (const audio of execution.audios) console.log(`🟢 ${audio.absPath}`)
95
+ host.disconnect()
96
+ }
@@ -0,0 +1,54 @@
1
+ // z-image t2i base on Comfy Cloud — Z-Image base bf16, the undistilled model: 25 steps with real cfg and a negative prompt
2
+ // source template: image_z_image.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/z-image-t2i-base.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 zImageT2iBase = host.defineWorkflow({
11
+ id: 'z-image-t2i-base',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'A fashion photograph full of surreal romanticism, low-angle shot against a clear light blue sky. The vegetation is rendered in shades of blue, from ice blue to deep cobalt, with delicate realistic leaves; warm brown trunks contrast with the cool foliage like a dreamy forest from another world. A model in a yellow and white vertically striped long dress walks slowly on the sand, the noon sun casting clear shadows. Clean, transparent colors, quiet and poetic high-fashion mood.',
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(25, { min: 1, max: 80 }),
19
+ cfg: v.float(4, { min: 1, max: 10 }),
20
+ size: v.size({ width: 1024, height: 1024 }),
21
+ },
22
+ build: (b, vars) => {
23
+ const model = b.ModelSamplingAuraFlow({
24
+ model: b.UNETLoader({ unet_name: 'z_image_bf16.safetensors', weight_dtype: 'default' }),
25
+ shift: 3,
26
+ })
27
+ const clip = b.CLIPLoader({ clip_name: 'qwen_3_4b.safetensors', type: 'lumina2', device: 'default' })
28
+ const samples = b.KSampler({
29
+ model,
30
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
31
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
32
+ latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
33
+ seed: vars.seed,
34
+ steps: vars.steps,
35
+ cfg: vars.cfg,
36
+ sampler_name: 'res_multistep',
37
+ scheduler: 'simple',
38
+ denoise: 1,
39
+ })
40
+ b.SaveImageWebsocket({ images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'ae.safetensors' }) }) })
41
+ },
42
+ })
43
+
44
+ export default zImageT2iBase
45
+
46
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
47
+ if (import.meta.main) {
48
+ requireCloudKey()
49
+ if (process.argv[2]) zImageT2iBase.vars.prompt.set(process.argv[2])
50
+ if (process.argv[3]) zImageT2iBase.vars.seed.set(Number(process.argv[3]))
51
+ const execution = await zImageT2iBase.run({ log: true, save: { prefix: 'comfy-ts-zoo/z-image-t2i-base' } })
52
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
53
+ host.disconnect()
54
+ }
@@ -1,5 +1,5 @@
1
1
  // krea2 turbo text-to-image, ported from a real production pipeline
2
- // (rabbits-vs-sheeps "unified"). krea2 turbo UNET + standard LoraLoader chain
2
+ // (a game's "unified" sprite flow). krea2 turbo UNET + standard LoraLoader chain
3
3
  // → KSampler(8 steps, cfg 1) → RMBG cutout → transparent png game sprite.
4
4
  //
5
5
  // run directly: bun examples/rvion/04-krea2-turbo-t2i.cflow.ts ["prompt"] [seed]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comfy-ts",
3
- "version": "2.17.1",
3
+ "version": "2.18.0",
4
4
  "description": "The complete TypeScript toolkit for ComfyUI and generative AI. Fully type-safe SDK with autocomplete on every node, companion CLI, TUI, agentic docs, and 50+ examples. Design, run and deploy creative pipelines for image, video, audio, 3d and text on any ComfyUI, local, cloud or hosted.",
5
5
  "keywords": [
6
6
  "comfyui",
@@ -140,7 +140,7 @@
140
140
  "oxfmt": "^0.60.0",
141
141
  "oxlint": "^1.75.0",
142
142
  "oxlint-tsgolint": "^7.0.2001",
143
- "rvlib-shipkit": "^2.6.0",
143
+ "rvlib-shipkit": "^2.25.0",
144
144
  "rvlib-ts-tools": "^0.3.3",
145
145
  "tsdown": "^0.22.14",
146
146
  "typescript": "^7.0.2"
@@ -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 of every branch: the selected ones are written here, the rest are dropped */
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
- if (kind.kind === 'dynamic-combo') {
194
- this._writeDynamicCombo({
195
- name: i.nameInComfy,
196
- options: kind.options,
197
- defaultKey: kind.defaultKey,
198
- provided: promptExt.inputs,
199
- out: inputs,
200
- claimed: _comboBranchKeys,
201
- })
202
- continue
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`,
@@ -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
- /** binary frame types we already complained about (one log per type, no spam) */
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
- const msg_: unknown = JSON.parse(String(e.data))
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
- // ----- crystools silent fix -----
925
- if (typeof msg_ === 'object' && msg_ != null && 'type' in msg_) {
926
- if (msg_.type === 'crystools.monitor') return
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) this.onSession?.(msg.data.sid)
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
  }