comfy-ts 2.21.0 → 2.23.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 (104) hide show
  1. package/dist/{ServeApp-ByMobrWW.js → ServeApp-DolRCMHj.js} +183 -14
  2. package/dist/ServeApp-DolRCMHj.js.map +1 -0
  3. package/dist/cli.js +5 -5
  4. package/dist/{exampleAssets-B5sMqNia.js → exampleAssets-Duneoq6r.js} +331 -42
  5. package/dist/exampleAssets-Duneoq6r.js.map +1 -0
  6. package/dist/{findDefinedWorkflow-BNZgYIww.js → findDefinedWorkflow-DjoJA8y7.js} +2 -2
  7. package/dist/{findDefinedWorkflow-BNZgYIww.js.map → findDefinedWorkflow-DjoJA8y7.js.map} +1 -1
  8. package/dist/index.cjs +381 -34
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +201 -24
  11. package/dist/index.d.ts +201 -24
  12. package/dist/index.js +380 -35
  13. package/dist/index.js.map +1 -1
  14. package/dist/{run-run-CuBSygku.js → run-run-Cr0L9lCK.js} +5 -5
  15. package/dist/{run-run-CuBSygku.js.map → run-run-Cr0L9lCK.js.map} +1 -1
  16. package/dist/{run-serve-COk_G0Qz.js → run-serve---qA7o_m.js} +4 -4
  17. package/dist/{run-serve-COk_G0Qz.js.map → run-serve---qA7o_m.js.map} +1 -1
  18. package/dist/{run-tui-CB6i_x2y.js → run-tui-DxXiWo5J.js} +4 -4
  19. package/dist/{run-tui-CB6i_x2y.js.map → run-tui-DxXiWo5J.js.map} +1 -1
  20. package/dist/{schemaDrift-CHDVYlaj.js → schemaDrift-BTxdABHi.js} +36 -2
  21. package/dist/schemaDrift-BTxdABHi.js.map +1 -0
  22. package/dist/serve-web.js +207 -47
  23. package/dist/web.d.ts +201 -24
  24. package/dist/web.js +380 -35
  25. package/dist/web.js.map +1 -1
  26. package/examples/README.md +2 -0
  27. package/examples/comfy-cloud/sdk.d.ts +102 -1
  28. package/examples/depth-explorer/models.ts +722 -0
  29. package/examples/depth-explorer/serve.ts +140 -0
  30. package/examples/depth-explorer/thumbs/bae.webp +0 -0
  31. package/examples/depth-explorer/thumbs/da3-mono-large.webp +0 -0
  32. package/examples/depth-explorer/thumbs/dav1-vitl.webp +0 -0
  33. package/examples/depth-explorer/thumbs/dav2-vitl.webp +0 -0
  34. package/examples/depth-explorer/thumbs/dsine.webp +0 -0
  35. package/examples/depth-explorer/thumbs/iid-albedo.webp +0 -0
  36. package/examples/depth-explorer/thumbs/iid-metalness.webp +0 -0
  37. package/examples/depth-explorer/thumbs/iid-roughness.webp +0 -0
  38. package/examples/depth-explorer/thumbs/iid-shading.webp +0 -0
  39. package/examples/depth-explorer/thumbs/iid-specular.webp +0 -0
  40. package/examples/depth-explorer/thumbs/leres.webp +0 -0
  41. package/examples/depth-explorer/thumbs/lotus-depth.webp +0 -0
  42. package/examples/depth-explorer/thumbs/marigold2-albedo.webp +0 -0
  43. package/examples/depth-explorer/thumbs/marigold2-depth.webp +0 -0
  44. package/examples/depth-explorer/thumbs/marigold2-normal.webp +0 -0
  45. package/examples/depth-explorer/thumbs/metric3d-depth.webp +0 -0
  46. package/examples/depth-explorer/thumbs/metric3d-normal.webp +0 -0
  47. package/examples/depth-explorer/thumbs/midas-normal.webp +0 -0
  48. package/examples/depth-explorer/thumbs/midas.webp +0 -0
  49. package/examples/depth-explorer/thumbs/moge2-depth.webp +0 -0
  50. package/examples/depth-explorer/thumbs/moge2-normal.webp +0 -0
  51. package/examples/depth-explorer/thumbs/zoe-da.webp +0 -0
  52. package/examples/depth-explorer/thumbs/zoe.webp +0 -0
  53. package/examples/depth-explorer/web/App.tsx +457 -0
  54. package/examples/depth-explorer/web/gl.ts +202 -0
  55. package/examples/depth-explorer/web/index.html +14 -0
  56. package/examples/depth-explorer/web/main.tsx +19 -0
  57. package/examples/depth-explorer/web/pixels.ts +86 -0
  58. package/examples/depth-explorer/web/state.ts +329 -0
  59. package/examples/depth-explorer/web/styles.css +366 -0
  60. package/examples/depth-explorer/web/tsconfig.json +16 -0
  61. package/examples/rvion/17-relight.cflow.ts +110 -0
  62. package/examples/rvion/18-world.cflow.ts +101 -0
  63. package/examples/world-explorer/serve.ts +171 -0
  64. package/examples/world-explorer/web/index.html +14 -0
  65. package/examples/world-explorer/web/main.tsx +200 -0
  66. package/examples/world-explorer/web/state.ts +212 -0
  67. package/examples/world-explorer/web/styles.css +131 -0
  68. package/examples/world-explorer/web/thumb.ts +21 -0
  69. package/examples/world-explorer/web/tsconfig.json +11 -0
  70. package/examples/world-explorer/world-state.ts +40 -0
  71. package/package.json +6 -7
  72. package/src/cli/serve/ServeApp.ts +106 -6
  73. package/src/cli/serve/describeVar.ts +12 -1
  74. package/src/cli/serve/resultHistory.ts +28 -5
  75. package/src/cli/serve/thumbs.ts +77 -0
  76. package/src/cli/serve/web/api.ts +9 -1
  77. package/src/cli/serve/web/components/Gallery.tsx +26 -1
  78. package/src/cli/serve/web/components/controls/BasicControls.tsx +14 -17
  79. package/src/cli/serve/web/components/controls/MediaControl.tsx +62 -9
  80. package/src/cli/serve/web/components/controls/RichSelect.tsx +262 -0
  81. package/src/cli/serve/web/state/RunSt.poll.test.ts +4 -1
  82. package/src/cli/serve/web/state/choiceButtons.ts +26 -2
  83. package/src/cli/serve/web/styles.ts +42 -0
  84. package/src/cli/serve/web/widgets/OutputWidgets.tsx +19 -0
  85. package/src/cli/serve/web/widgets/RelightSt.ts +113 -0
  86. package/src/cli/serve/web/widgets/RelightWidget.tsx +305 -0
  87. package/src/cli/serve/web/widgets/relightGl.ts +305 -0
  88. package/src/cli/serve/web/widgets/widgetStyles.ts +19 -0
  89. package/src/coreExports.ts +10 -0
  90. package/src/graph/ComfyNode.ts +12 -2
  91. package/src/host/ComfyHost.ts +153 -2
  92. package/src/host/ResilientWebsocket.ts +10 -0
  93. package/src/manager/script-update-manager.bun.ts +0 -7
  94. package/src/runner/ComfyExecution.ts +165 -20
  95. package/src/runner/ComfyWsApi.ts +2 -0
  96. package/src/runner/historyReplay.ts +53 -0
  97. package/src/runner/outputs3d.ts +18 -0
  98. package/src/sdk-generator/comfyui-sdk-codegen.ts +7 -2
  99. package/src/vars/ComfyVars.ts +32 -2
  100. package/src/vars/DefinedWorkflow.ts +4 -0
  101. package/src/vars/outputWidgets.ts +47 -0
  102. package/dist/ServeApp-ByMobrWW.js.map +0 -1
  103. package/dist/exampleAssets-B5sMqNia.js.map +0 -1
  104. package/dist/schemaDrift-CHDVYlaj.js.map +0 -1
package/dist/web.d.ts CHANGED
@@ -12262,27 +12262,27 @@ declare const types$1: import("arktype").Module<{
12262
12262
  };
12263
12263
  PromptID: PromptID;
12264
12264
  PromptRelated_WsMsg: {
12265
- type: "execution_start";
12265
+ type: "progress";
12266
12266
  data: {
12267
- prompt_id: PromptID;
12267
+ value: number;
12268
+ max: number;
12268
12269
  };
12269
12270
  } | {
12270
- type: "execution_cached";
12271
+ type: "executing";
12271
12272
  data: {
12272
- nodes: ComfyNodeId[];
12273
12273
  prompt_id: PromptID;
12274
+ node?: ComfyNodeId | null | undefined;
12274
12275
  };
12275
12276
  } | {
12276
- type: "executing";
12277
+ type: "execution_cached";
12277
12278
  data: {
12279
+ nodes: ComfyNodeId[];
12278
12280
  prompt_id: PromptID;
12279
- node?: ComfyNodeId | null | undefined;
12280
12281
  };
12281
12282
  } | {
12282
- type: "progress";
12283
+ type: "execution_start";
12283
12284
  data: {
12284
- value: number;
12285
- max: number;
12285
+ prompt_id: PromptID;
12286
12286
  };
12287
12287
  } | {
12288
12288
  type: "progress_state";
@@ -12318,6 +12318,11 @@ declare const types$1: import("arktype").Module<{
12318
12318
  subfolder: string;
12319
12319
  type: string;
12320
12320
  }[] | undefined;
12321
+ '3d'?: {
12322
+ filename: string;
12323
+ subfolder: string;
12324
+ type: string;
12325
+ }[] | undefined;
12321
12326
  text?: unknown[] | undefined;
12322
12327
  } | null;
12323
12328
  prompt_id: PromptID;
@@ -12361,27 +12366,27 @@ declare const types$1: import("arktype").Module<{
12361
12366
  data: string;
12362
12367
  };
12363
12368
  WsMsg: {
12364
- type: "execution_start";
12369
+ type: "progress";
12365
12370
  data: {
12366
- prompt_id: PromptID;
12371
+ value: number;
12372
+ max: number;
12367
12373
  };
12368
12374
  } | {
12369
- type: "execution_cached";
12375
+ type: "executing";
12370
12376
  data: {
12371
- nodes: ComfyNodeId[];
12372
12377
  prompt_id: PromptID;
12378
+ node?: ComfyNodeId | null | undefined;
12373
12379
  };
12374
12380
  } | {
12375
- type: "executing";
12381
+ type: "execution_cached";
12376
12382
  data: {
12383
+ nodes: ComfyNodeId[];
12377
12384
  prompt_id: PromptID;
12378
- node?: ComfyNodeId | null | undefined;
12379
12385
  };
12380
12386
  } | {
12381
- type: "progress";
12387
+ type: "execution_start";
12382
12388
  data: {
12383
- value: number;
12384
- max: number;
12389
+ prompt_id: PromptID;
12385
12390
  };
12386
12391
  } | {
12387
12392
  type: "progress_state";
@@ -12417,6 +12422,11 @@ declare const types$1: import("arktype").Module<{
12417
12422
  subfolder: string;
12418
12423
  type: string;
12419
12424
  }[] | undefined;
12425
+ '3d'?: {
12426
+ filename: string;
12427
+ subfolder: string;
12428
+ type: string;
12429
+ }[] | undefined;
12420
12430
  text?: unknown[] | undefined;
12421
12431
  } | null;
12422
12432
  prompt_id: PromptID;
@@ -12502,6 +12512,11 @@ declare const types$1: import("arktype").Module<{
12502
12512
  subfolder: string;
12503
12513
  type: string;
12504
12514
  }[] | undefined;
12515
+ '3d'?: {
12516
+ filename: string;
12517
+ subfolder: string;
12518
+ type: string;
12519
+ }[] | undefined;
12505
12520
  text?: unknown[] | undefined;
12506
12521
  } | null;
12507
12522
  prompt_id: PromptID;
@@ -12627,6 +12642,11 @@ declare const types$1: import("arktype").Module<{
12627
12642
  subfolder: string;
12628
12643
  type: string;
12629
12644
  }[] | undefined;
12645
+ '3d'?: {
12646
+ filename: string;
12647
+ subfolder: string;
12648
+ type: string;
12649
+ }[] | undefined;
12630
12650
  text?: unknown[] | undefined;
12631
12651
  } | null;
12632
12652
  prompt_id: PromptID;
@@ -12655,6 +12675,11 @@ declare const types$1: import("arktype").Module<{
12655
12675
  subfolder: string;
12656
12676
  type: string;
12657
12677
  }[] | undefined;
12678
+ '3d'?: {
12679
+ filename: string;
12680
+ subfolder: string;
12681
+ type: string;
12682
+ }[] | undefined;
12658
12683
  text?: unknown[] | undefined;
12659
12684
  };
12660
12685
  _WsMsgExecutionCachedData: {
@@ -13248,6 +13273,8 @@ type ComfyExecutionData = {
13248
13273
  graphID: ComfyWorkflowID;
13249
13274
  executed: boolean;
13250
13275
  error?: WsMsgExecutionError | WsMsgExecutionInterrupted | null;
13276
+ /** why comfy-ts failed the run itself, when no ComfyUI message says it (the host lost the prompt) */
13277
+ reason?: string | null;
13251
13278
  status?: ComfyExecutionStatus | null;
13252
13279
  };
13253
13280
  /** one audio file an output node published, downloaded as the server wrote it.
@@ -13262,6 +13289,11 @@ type ComfyAudioOutput = {
13262
13289
  /** one video file an output node published (SaveVideo, SaveWEBM, VHS_VideoCombine), same
13263
13290
  * shape and same retrieval as an audio file */
13264
13291
  type ComfyVideoOutput = ComfyAudioOutput;
13292
+ /** one 3D file an output node published (SaveGLB, SaveGaussianSplat, SavePointCloud): a mesh, a point
13293
+ * cloud or a splat, same retrieval as an audio file. `format` is the lowercase extension (glb, ply, spz…) */
13294
+ type Comfy3DOutput = ComfyAudioOutput & {
13295
+ format: string;
13296
+ };
13265
13297
  /** one text output as an output node published it (`nodeKey` is null when the node left the snapshot) */
13266
13298
  type ComfyTextOutput = {
13267
13299
  nodeId: ComfyNodeId;
@@ -13348,6 +13380,36 @@ declare class ComfyExecution {
13348
13380
  /** update execution list */
13349
13381
  private onExecuted;
13350
13382
  private pendingPromises;
13383
+ /** an end message arrived (or was replayed): every later message is ignored */
13384
+ private ended;
13385
+ /** the output nodes whose `executed` reached us, so a /history replay never retrieves one twice */
13386
+ private heardExecuted;
13387
+ /** the run lived through a reconnect and may have lost events: its end reads /history for them */
13388
+ private mayHaveMissedEvents;
13389
+ private replayUnheardOutputs;
13390
+ /** the history entry is written right after the end message is queued, so it may lag by a moment */
13391
+ historyRetry: {
13392
+ tries: number;
13393
+ ms: number;
13394
+ };
13395
+ /** a run that lived through a reconnect: an output node that ended in the gap is only in /history */
13396
+ private retrieveMissedOutputs;
13397
+ /** @internal the last event of this run: the watchdog checks only runs quiet for host.runSilenceMs */
13398
+ lastHeardAt: number;
13399
+ /** @internal a check is in flight: never two at once */
13400
+ reconciling: boolean;
13401
+ private loggedReconcileProblems;
13402
+ private heard;
13403
+ private logReconcileOnce;
13404
+ /** @internal called before the host reads its queue. After a reconnect the run may have lost events,
13405
+ * so its end reads /history for them; the flag is set before any await, so a live end that lands
13406
+ * during the reads still looks. A check for silence alone does not set it: a quiet run lost nothing */
13407
+ beginReconcile(why: 'reconnect' | 'silence'): void;
13408
+ /** @internal ask the host where this run stands. `queued` is the host's queue read BEFORE this
13409
+ * history read (the server moves a prompt from one to the other under one lock, so this order never
13410
+ * misses a run that ended between the two reads); null when it did not answer, and then the run is
13411
+ * never declared lost. A queued run needs no history read. Says how the check ended */
13412
+ reconcile: (queued: Set<string> | null) => Promise<'history' | 'waiting' | 'lost'>;
13351
13413
  /** audio retrievals that failed (their files are missing from `audios`) */
13352
13414
  audioErrors: {
13353
13415
  audio: ComfyImageInfo;
@@ -13362,6 +13424,14 @@ declare class ComfyExecution {
13362
13424
  }[];
13363
13425
  /** video files retrieved for this execution, in arrival order (final once `done` resolves) */
13364
13426
  videos: ComfyVideoOutput[];
13427
+ /** 3D retrievals that failed (their files are missing from `models3d`) */
13428
+ models3dErrors: {
13429
+ model3d: ComfyImageInfo;
13430
+ error: unknown;
13431
+ }[];
13432
+ /** 3D files retrieved for this execution, in arrival order (final once `done` resolves) */
13433
+ models3d: Comfy3DOutput[];
13434
+ /** one non-image file through /view, its bytes as the server wrote them; the caller files it */
13365
13435
  private retrieveFile;
13366
13436
  /** image retrievals that failed (their images are missing from `images`);
13367
13437
  * `image` is null for SaveImageWebsocket frames (no server-side file info exists) */
@@ -16813,6 +16883,7 @@ type WsDebugMessage = {
16813
16883
  };
16814
16884
  declare class ResilientWebSocketClient {
16815
16885
  options: {
16886
+ /** re-read on every connect */
16816
16887
  url: () => string;
16817
16888
  /** upgrade-request headers (auth: X-API-Key & co) — a thunk, re-read on every reconnect.
16818
16889
  * On a headerless transport (browser) X-API-Key rides `?token=` instead
@@ -16849,6 +16920,7 @@ declare class ResilientWebSocketClient {
16849
16920
  private addInfo;
16850
16921
  private addError;
16851
16922
  constructor(options: {
16923
+ /** re-read on every connect */
16852
16924
  url: () => string;
16853
16925
  /** upgrade-request headers (auth: X-API-Key & co) — a thunk, re-read on every reconnect.
16854
16926
  * On a headerless transport (browser) X-API-Key rides `?token=` instead
@@ -16885,6 +16957,8 @@ declare class ResilientWebSocketClient {
16885
16957
  private stopHeartbeat;
16886
16958
  /** ping on a timer; no pong since the previous ping = the peer is gone, drop the socket */
16887
16959
  private startHeartbeat;
16960
+ /** close the socket cleanly, then reconnect as after any close: the server ends its handler first */
16961
+ reconnect(): void;
16888
16962
  /** close and stop reconnecting (lets a script exit cleanly) */
16889
16963
  disconnectPermanently(): void;
16890
16964
  /** headerless transports carry the api key as ?token= — everything else is refused loud */
@@ -16925,6 +16999,41 @@ type LoraLanes<T extends string = string> = {
16925
16999
  * lanes object can never be mistaken for each other */
16926
17000
  type LorasInput<T extends string = string> = LoraRecord<T> | LoraLanes<T>;
16927
17001
  //#endregion
17002
+ //#region src/vars/outputWidgets.d.ts
17003
+ /** the maps a relight widget reads, each the tag of one output image */
17004
+ type RelightRoles = {
17005
+ /** the photo itself; the base colour when no albedo is given */
17006
+ image: string;
17007
+ /** near = white; places each pixel in 3D and casts the shadows */
17008
+ depth?: string;
17009
+ /** OpenGL convention (green up) */
17010
+ normal?: string;
17011
+ albedo?: string;
17012
+ /** white = rough */
17013
+ roughness?: string;
17014
+ /** white = metal */
17015
+ metalness?: string;
17016
+ /** the non diffuse part of the light (reflections, highlights) */
17017
+ specular?: string;
17018
+ };
17019
+ type RelightWidget = {
17020
+ kind: 'relight';
17021
+ title?: string;
17022
+ roles: RelightRoles;
17023
+ };
17024
+ type OutputWidget = RelightWidget;
17025
+ type OutputWidgetKind = OutputWidget['kind'];
17026
+ declare const widget: {
17027
+ /** a point light moved over the image in 3D: left/right, up/down, nearer/farther */
17028
+ relight(roles: RelightRoles, opts?: {
17029
+ title?: string;
17030
+ }): RelightWidget;
17031
+ };
17032
+ /** the roles of a widget whose tag one of the images carries, as role → index in `images` */
17033
+ declare function resolveWidgetRoles(w: OutputWidget, images: {
17034
+ tags?: string[];
17035
+ }[]): Map<string, number>;
17036
+ //#endregion
16928
17037
  //#region src/vars/presets.d.ts
16929
17038
  type VarPreset = {
16930
17039
  label: string;
@@ -16957,6 +17066,27 @@ type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice
16957
17066
  */
16958
17067
  /** how a var LOOKS in the panel, set by the workflow: `v.int(8).ui({ icon, color, description })`.
16959
17068
  * Every slot is optional, a color is any css color */
17069
+ /** how one option of a choice var looks in the panel. Every field is optional: a bare option
17070
+ * shows its value */
17071
+ type ChoiceOptionLook = {
17072
+ /** a 24×24 svg path drawn in the color, or a whole `<svg …>` string */
17073
+ icon?: string;
17074
+ color?: string;
17075
+ /** the name shown instead of the raw value (the value stays the payload) */
17076
+ label?: string;
17077
+ description?: string;
17078
+ /** a picture: an http(s) url, or a local path relative to the workflow file */
17079
+ thumb?: string;
17080
+ /** when it came out: `2025`, `2025-11` */
17081
+ date?: string;
17082
+ /** what it weighs on disk: `1.3 GB` */
17083
+ size?: string;
17084
+ /** 1 (rough) to 5 (the best of its kind) */
17085
+ quality?: number;
17086
+ /** how long it takes: `0.9 s`, `30 s` */
17087
+ speed?: string;
17088
+ tags?: string[];
17089
+ };
16960
17090
  type VarUi = {
16961
17091
  /** shown as a (?) after the label, the text is its tooltip */
16962
17092
  description?: string;
@@ -16973,11 +17103,8 @@ type VarUi = {
16973
17103
  groupColor?: string;
16974
17104
  border?: string;
16975
17105
  /** choice vars: a look per option, keyed by the option value. The lit option is filled
16976
- * with its own color */
16977
- options?: Record<string, {
16978
- icon?: string;
16979
- color?: string;
16980
- }>;
17106
+ * with its own color; a dropdown row shows the rest (ChoiceOptionLook) */
17107
+ options?: Record<string, ChoiceOptionLook>;
16981
17108
  /** the field is shown but disabled unless every named var holds one of the listed values:
16982
17109
  * `{ model: ['aesthetic', 'base'] }`. Checked against the var names when the workflow loads.
16983
17110
  * Display only: a disabled var's value still reaches the build */
@@ -17380,6 +17507,10 @@ type MediaVarOpts = {
17380
17507
  /** the text var a file's `<name>.txt` sidecar fills, when a driver sets this var from a file
17381
17508
  * and leaves that one unset: a voice clip's transcript (`comfy-ts run`) */
17382
17509
  sidecarText?: TextVar;
17510
+ /** one-click starting files: `{ 'a lioness': exampleImagePath(…), 'a ruin': 'https://…' }`.
17511
+ * A local path that is not on this machine is shown disabled, a url is fetched when a run
17512
+ * uses it. Key order is display order */
17513
+ presets?: Record<string, string>;
17383
17514
  };
17384
17515
  type ImageVarOpts = MediaVarOpts;
17385
17516
  type AudioVarOpts = MediaVarOpts;
@@ -17411,6 +17542,11 @@ declare abstract class MediaVar extends ComfyVar<string> {
17411
17542
  constructor(defaultValue: string, opts?: MediaVarOpts);
17412
17543
  /** what the picker lists (lowercase, no dots) */
17413
17544
  get extensions(): readonly string[];
17545
+ /** the one-click starting files, `~/` expanded, in their declared order */
17546
+ get presets(): {
17547
+ label: string;
17548
+ value: string;
17549
+ }[];
17414
17550
  set(value: string): this;
17415
17551
  parse(raw: string): boolean;
17416
17552
  isSet(): boolean;
@@ -17559,6 +17695,9 @@ type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
17559
17695
  /** free search tags for the serve omnibox, added to the ones read from the graph
17560
17696
  * (`image`, `audio`, `video`, `text`, `llm`, `edit`) */
17561
17697
  tags?: string[];
17698
+ /** built-in web panel widgets drawn over a run's outputs (`widget.relight(...)`), each role
17699
+ * naming the `tag` of a save node. The CLI and the TUI ignore them */
17700
+ widgets?: OutputWidget[];
17562
17701
  };
17563
17702
  /**
17564
17703
  * a re-runnable workflow definition: `build` re-executes per run with the
@@ -17836,6 +17975,42 @@ declare class ComfyHost<ID extends string = string> {
17836
17975
  loadSchemaFromCache(): Promise<void>;
17837
17976
  /** POST a JSON route through host.fetch (/api preferred, bare fallback) */
17838
17977
  private postJSON_;
17978
+ /** GET a json route for the run checks: an answer that is not json (a 404, a 405, a page) means the
17979
+ * host has no such route, a HostRouteUnusableError; a network failure stays a plain error */
17980
+ private fetchReconcileJSON_;
17981
+ /** one prompt's `GET /history/<id>` reply, `{}` while the host has no entry for it */
17982
+ fetchHistory: (promptId: PromptID) => Promise<unknown>;
17983
+ /** the ids of the prompts waiting or running on this host, every client counted (`GET /queue`) */
17984
+ fetchQueuedPromptIds: () => Promise<Set<string>>;
17985
+ /** why runs on this host are never checked over http: its /queue or /history is not ComfyUI's
17986
+ * (a cloud host). Null while both answered as ComfyUI does, or were never asked */
17987
+ reconcileOff: string | null;
17988
+ /** @internal a failed run check: true when it proved the host has no usable route (the checks then
17989
+ * stop for good, said once), false for a passing failure the caller reports */
17990
+ noteReconcileFailure(e: unknown): boolean;
17991
+ /** fetchQueuedPromptIds, null when the queue did not answer (logged once per message) or has another
17992
+ * shape: a run is then never declared lost */
17993
+ fetchQueuedPromptIdsOrNull: () => Promise<Set<string> | null>;
17994
+ private _loggedQueueProblems;
17995
+ /** a check needs the WHOLE socket quiet this long, and the run itself too */
17996
+ runSilenceMs: number;
17997
+ /** the wait doubles after each check that ends no run, up to this; any ws message resets it */
17998
+ runSilenceMaxMs: number;
17999
+ private _silenceWaitMs;
18000
+ private _lastCheckAt;
18001
+ private _checking;
18002
+ private _watchdog;
18003
+ /** @internal a new run routes its ws messages here, and the watchdog watches it */
18004
+ trackExecution(execution: ComfyExecution): void;
18005
+ private stopWatchdog;
18006
+ /** a socket that hears no broadcast and no event for a while is deaf, or the host runs one long
18007
+ * quiet node: ask. A run queued behind a talking host is never asked about */
18008
+ private watchdogTick;
18009
+ /** @internal one queue read for all the runs, then the history of each run not in it. A run that
18010
+ * ends from its history while the socket looked fine means the socket hears nothing: ComfyUI removes
18011
+ * a session BY KEY when a socket's handler ends, so an old handler that ends after a reconnect evicts
18012
+ * the new socket of the same session. A clean close lets the server end that handler first */
18013
+ reconcileRuns(runs: ComfyExecution[], why: 'reconnect' | 'silence'): Promise<void>;
17839
18014
  /** drop every PENDING prompt from the server queue (the running one keeps going) */
17840
18015
  clearQueue: () => Promise<void>;
17841
18016
  /** a repeat interrupt for the same running prompt inside this window reuses the first request */
@@ -17922,6 +18097,8 @@ declare class ComfyHost<ID extends string = string> {
17922
18097
  * spam); both sets clear when the server assigns a new session id */
17923
18098
  private _unknownBinaryFrameTypes;
17924
18099
  private _unknownWsEventTypes;
18100
+ /** the socket opened and its first 'status' has not come yet */
18101
+ private _socketIsNew;
17925
18102
  /** handy to keep around */
17926
18103
  status: ComfyStatusData['status'] | null;
17927
18104
  /** last time ANY ws message arrived — proof-of-life for the TUI probe: a
@@ -18945,5 +19122,5 @@ type HostToPanel = {
18945
19122
  comfyTs: 'get-state';
18946
19123
  };
18947
19124
  //#endregion
18948
- export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyChoiceVar, type AnyVar, AudioVar, type AudioVarOpts, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, type ChoiceSelect, ChoiceVar, type CodegenOptions, type ComfyApiJson, type ComfyApiNodeJson, type ComfyAudioOutput, ComfyExecution, type ComfyExecutionData, type ComfyExecutionStatus, ComfyHost, ComfyHostAuthError, type ComfyHostData, type ComfyHostID, ComfyHostUnreachableError, type ComfyImageName, ComfyManager, ComfyNode, type ComfyNodeId, type ComfyNodeIdMode, type ComfyNodeMetadata, ComfyNodeOutput, type ComfyNodeSchemaJSON, ComfySchema, type ComfySchemaJSON, ComfySdkBase, ComfySdkShape, type ComfyStorage, ComfyTS, type ComfyTextOutput, type ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, type ComfyVideoOutput, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionPreview, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, type HostSlotSource, type HostToPanel, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LmLoraItem, type LoraEntry, type LoraLane, type LoraLanes, type LoraMirror, type LoraNameOf, type LoraRecord, type LoraStrength, type LoraSweep, type LorasHost, type LorasInput, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, MediaVar, MediaVarEmptyError, type MediaVarOpts, type ModelVarOpts, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type PanelError, type PanelHostAction, type PanelRequest, type PanelResultAction, type PanelState, type PanelToHost, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type PreviewMethod, type ProgressReport, type PromptID, type PromptInput, type PromptLane, type PromptLanes, type PromptRelated_WsMsg, type PromptTagsOpts, type PromptValue, PromptVar, type PromptVarOpts, type QualifiedNodeKey, RelativePath, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SD15_SIZE_PRESETS, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, type SlotNameOf, type SlotValueOf, Tagged, TextVar, type TextVarOpts, ToggleVar, type VarKind, type VarPreset, type VarPresetSpec, type VarUi, type VarValues, type VarsSpec, VideoVar, type VideoVarOpts, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
19125
+ export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyChoiceVar, type AnyVar, AudioVar, type AudioVarOpts, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, type ChoiceOptionLook, type ChoiceSelect, ChoiceVar, type CodegenOptions, type Comfy3DOutput, type ComfyApiJson, type ComfyApiNodeJson, type ComfyAudioOutput, ComfyExecution, type ComfyExecutionData, type ComfyExecutionStatus, ComfyHost, ComfyHostAuthError, type ComfyHostData, type ComfyHostID, ComfyHostUnreachableError, type ComfyImageName, ComfyManager, ComfyNode, type ComfyNodeId, type ComfyNodeIdMode, type ComfyNodeMetadata, ComfyNodeOutput, type ComfyNodeSchemaJSON, ComfySchema, type ComfySchemaJSON, ComfySdkBase, ComfySdkShape, type ComfyStorage, ComfyTS, type ComfyTextOutput, type ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, type ComfyVideoOutput, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionPreview, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, type HostSlotSource, type HostToPanel, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LmLoraItem, type LoraEntry, type LoraLane, type LoraLanes, type LoraMirror, type LoraNameOf, type LoraRecord, type LoraStrength, type LoraSweep, type LorasHost, type LorasInput, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, MediaVar, MediaVarEmptyError, type MediaVarOpts, type ModelVarOpts, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type OutputWidget, type OutputWidgetKind, type PanelError, type PanelHostAction, type PanelRequest, type PanelResultAction, type PanelState, type PanelToHost, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type PreviewMethod, type ProgressReport, type PromptID, type PromptInput, type PromptLane, type PromptLanes, type PromptRelated_WsMsg, type PromptTagsOpts, type PromptValue, PromptVar, type PromptVarOpts, type QualifiedNodeKey, RelativePath, type RelightRoles, type RelightWidget, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SD15_SIZE_PRESETS, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, type SlotNameOf, type SlotValueOf, Tagged, TextVar, type TextVarOpts, ToggleVar, type VarKind, type VarPreset, type VarPresetSpec, type VarUi, type VarValues, type VarsSpec, VideoVar, type VideoVarOpts, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resolveWidgetRoles, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v, widget };
18949
19126
  //# sourceMappingURL=web.d.ts.map