comfy-ts 2.22.0 → 2.24.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 (99) hide show
  1. package/dist/{ServeApp-DuxYdaZZ.js → ServeApp-fsHtW5zG.js} +51 -17
  2. package/dist/ServeApp-fsHtW5zG.js.map +1 -0
  3. package/dist/cli.js +5 -5
  4. package/dist/{exampleAssets-1NHndnNB.js → exampleAssets-DZynSkZm.js} +405 -39
  5. package/dist/exampleAssets-DZynSkZm.js.map +1 -0
  6. package/dist/{findDefinedWorkflow-CRsBTTJK.js → findDefinedWorkflow-qyqFea7q.js} +2 -2
  7. package/dist/{findDefinedWorkflow-CRsBTTJK.js.map → findDefinedWorkflow-qyqFea7q.js.map} +1 -1
  8. package/dist/index.cjs +428 -46
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +147 -1
  11. package/dist/index.d.ts +147 -1
  12. package/dist/index.js +428 -47
  13. package/dist/index.js.map +1 -1
  14. package/dist/{run-run-Y5ZI48vV.js → run-run-Cn2JzKlE.js} +5 -5
  15. package/dist/{run-run-Y5ZI48vV.js.map → run-run-Cn2JzKlE.js.map} +1 -1
  16. package/dist/{run-serve-CICU_wTL.js → run-serve-BhGegaCI.js} +4 -4
  17. package/dist/{run-serve-CICU_wTL.js.map → run-serve-BhGegaCI.js.map} +1 -1
  18. package/dist/{run-tui-CViJXsHL.js → run-tui-CrM4ijkH.js} +4 -4
  19. package/dist/{run-tui-CViJXsHL.js.map → run-tui-CrM4ijkH.js.map} +1 -1
  20. package/dist/{schemaDrift-CzjaIwZX.js → schemaDrift-BGYJZGMD.js} +18 -3
  21. package/dist/{schemaDrift-CzjaIwZX.js.map → schemaDrift-BGYJZGMD.js.map} +1 -1
  22. package/dist/serve-web.js +46 -43
  23. package/dist/web.d.ts +147 -1
  24. package/dist/web.js +428 -47
  25. package/dist/web.js.map +1 -1
  26. package/examples/README.md +1 -0
  27. package/examples/comfy-cloud/sdk.d.ts +102 -1
  28. package/examples/depth-explorer/models.ts +6 -56
  29. package/examples/depth-explorer/serve.ts +12 -133
  30. package/examples/depth-explorer/web/App.tsx +20 -91
  31. package/examples/depth-explorer/web/index.html +1 -0
  32. package/examples/depth-explorer/web/state.ts +26 -109
  33. package/examples/depth-explorer/web/styles.css +1 -286
  34. package/examples/explorer-kit/catalog.ts +80 -0
  35. package/examples/explorer-kit/server.ts +167 -0
  36. package/examples/explorer-kit/web/base.css +289 -0
  37. package/examples/explorer-kit/web/runs.ts +160 -0
  38. package/examples/explorer-kit/web/ui.tsx +125 -0
  39. package/examples/rvion/17-relight.cflow.ts +2 -1
  40. package/examples/rvion/18-world.cflow.ts +101 -0
  41. package/examples/rvion/19-flythrough.cflow.ts +312 -0
  42. package/examples/rvion/20-grow-splat.cflow.ts +88 -0
  43. package/examples/rvion/21-photo-to-model.cflow.ts +191 -0
  44. package/examples/rvion/flythroughChain.ts +171 -0
  45. package/examples/rvion/flythroughColmap.ts +157 -0
  46. package/examples/rvion/flythroughFuse.ts +199 -0
  47. package/examples/rvion/flythroughGuide.ts +300 -0
  48. package/examples/rvion/flythroughPalette.ts +310 -0
  49. package/examples/rvion/flythroughPath.ts +177 -0
  50. package/examples/rvion/flythroughSplat.ts +73 -0
  51. package/examples/rvion/grow-splat/align.ts +114 -0
  52. package/examples/rvion/grow-splat/grow.ts +198 -0
  53. package/examples/rvion/grow-splat/ply.ts +166 -0
  54. package/examples/rvion/grow-splat/raster.ts +207 -0
  55. package/examples/rvion/grow-splat/sharp.ts +45 -0
  56. package/examples/rvion/splatDataset.ts +80 -0
  57. package/examples/rvion/splatEval.ts +380 -0
  58. package/examples/upscale-explorer/models.ts +341 -0
  59. package/examples/upscale-explorer/serve.ts +19 -0
  60. package/examples/upscale-explorer/web/App.tsx +250 -0
  61. package/examples/upscale-explorer/web/compare.tsx +285 -0
  62. package/examples/upscale-explorer/web/index.html +15 -0
  63. package/examples/upscale-explorer/web/main.tsx +12 -0
  64. package/examples/upscale-explorer/web/state.ts +279 -0
  65. package/examples/upscale-explorer/web/styles.css +241 -0
  66. package/examples/upscale-explorer/web/tsconfig.json +16 -0
  67. package/examples/upscale-explorer/web/viewport.tsx +130 -0
  68. package/examples/world-explorer/serve.ts +171 -0
  69. package/examples/world-explorer/web/index.html +14 -0
  70. package/examples/world-explorer/web/main.tsx +200 -0
  71. package/examples/world-explorer/web/state.ts +212 -0
  72. package/examples/world-explorer/web/styles.css +131 -0
  73. package/examples/world-explorer/web/thumb.ts +21 -0
  74. package/examples/world-explorer/web/tsconfig.json +11 -0
  75. package/examples/world-explorer/world-state.ts +40 -0
  76. package/package.json +7 -8
  77. package/src/cli/serve/ServeApp.ts +27 -2
  78. package/src/cli/serve/resultHistory.ts +22 -4
  79. package/src/cli/serve/thumbs.ts +19 -8
  80. package/src/cli/serve/web/api.ts +4 -0
  81. package/src/cli/serve/web/components/Gallery.tsx +24 -1
  82. package/src/cli/serve/web/styles.ts +3 -0
  83. package/src/coreExports.ts +6 -0
  84. package/src/graph/ComfyNode.ts +12 -2
  85. package/src/host/ComfyHost.ts +159 -2
  86. package/src/host/ResilientWebsocket.ts +10 -0
  87. package/src/manager/script-update-manager.bun.ts +0 -7
  88. package/src/runner/ComfyExecution.ts +185 -23
  89. package/src/runner/ComfyWorkflow.ts +22 -0
  90. package/src/runner/ComfyWsApi.ts +3 -1
  91. package/src/runner/comfyOrgApiKey.ts +44 -0
  92. package/src/runner/historyReplay.ts +53 -0
  93. package/src/runner/outputs3d.ts +18 -0
  94. package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +2 -0
  95. package/src/sdk-generator/comfyui-sdk-codegen.ts +7 -2
  96. package/src/state.ts +2 -0
  97. package/src/vars/DefinedWorkflow.ts +1 -0
  98. package/dist/ServeApp-DuxYdaZZ.js.map +0 -1
  99. package/dist/exampleAssets-1NHndnNB.js.map +0 -1
package/dist/index.js CHANGED
@@ -110,7 +110,7 @@ function createNodeStorage() {
110
110
  }
111
111
  //#endregion
112
112
  //#region package.json
113
- var version = "2.22.0";
113
+ var version = "2.24.0";
114
114
  //#endregion
115
115
  //#region src/litegraph/LiteGraphLinkID.ts
116
116
  const asLiteGraphLinkID = (id) => id;
@@ -1865,13 +1865,14 @@ var ComfyNode = class ComfyNode {
1865
1865
  throw new Error(`🔴 no input "${name}" on ${this.$schema.nodeKey}: cannot tell which output of the linked node to use`);
1866
1866
  }
1867
1867
  _getOutputForTypeOrCrash(type) {
1868
- const i = this.$schema.outputs.find((i) => i.typeName === type);
1868
+ const i = this.$schema.outputs.find((i) => slotTypeAccepts(type, i.typeName));
1869
+ if (i == null) throw new Error(`🔴 ${this.$schema.nodeKey} has no output of type ${type}: link one of its outputs by name instead`);
1869
1870
  const val = this.outputs[i.outKey];
1870
1871
  if (val instanceof ComfyNodeOutput) return val;
1871
1872
  throw new Error(`Expected ${i.outKey} to be a ComfyNodeOutput`);
1872
1873
  }
1873
1874
  _getOutputForTypeOrNull(type) {
1874
- const i = this.$schema.outputs.find((i) => i.typeName === type);
1875
+ const i = this.$schema.outputs.find((i) => slotTypeAccepts(type, i.typeName));
1875
1876
  if (i == null) return null;
1876
1877
  const val = this.outputs[i.outKey];
1877
1878
  if (val == null) return null;
@@ -1879,6 +1880,11 @@ var ComfyNode = class ComfyNode {
1879
1880
  throw new Error(`Expected ${i.outKey} to be a ComfyNodeOutput`);
1880
1881
  }
1881
1882
  };
1883
+ /** an input typed `MESH,FILE_3D_GLB` takes an output of ANY listed type (ComfyUI's SaveGLB) */
1884
+ function slotTypeAccepts(inputType, outputType) {
1885
+ if (inputType === outputType) return true;
1886
+ return inputType.includes(",") && inputType.split(",").some((part) => part.trim() === outputType);
1887
+ }
1882
1888
  //#endregion
1883
1889
  //#region src/host/ComfyWorkflowBuilder.ts
1884
1890
  var ComfyWorkflowBuilder = class {
@@ -2326,7 +2332,10 @@ const types$1 = scope({
2326
2332
  Timestamp: "number",
2327
2333
  ApiPromptInput: {
2328
2334
  client_id: "string",
2329
- extra_data: { extra_pnginfo: "unknown" },
2335
+ extra_data: {
2336
+ extra_pnginfo: "unknown",
2337
+ "api_key_comfy_org?": "string"
2338
+ },
2330
2339
  prompt: "unknown"
2331
2340
  },
2332
2341
  NodeProgress: {
@@ -2381,6 +2390,7 @@ const types$1 = scope({
2381
2390
  "audio?": "ComfyImageInfo[]",
2382
2391
  "video?": "ComfyImageInfo[]",
2383
2392
  "gifs?": "ComfyImageInfo[]",
2393
+ "3d?": "ComfyImageInfo[]",
2384
2394
  "text?": "unknown[]"
2385
2395
  },
2386
2396
  WsMsgExecuted: {
@@ -2742,6 +2752,88 @@ function mediaMime(filename) {
2742
2752
  return MIMES[extensionOf(filename)] ?? "application/octet-stream";
2743
2753
  }
2744
2754
  //#endregion
2755
+ //#region src/runner/outputs3d.ts
2756
+ /** ply and spz have no registered mime: the `x-` forms are what three.js and the splat viewers accept */
2757
+ const MODEL_3D_MIMES = {
2758
+ glb: "model/gltf-binary",
2759
+ gltf: "model/gltf+json",
2760
+ ply: "model/x-ply",
2761
+ spz: "model/x-spz",
2762
+ obj: "model/obj",
2763
+ stl: "model/stl"
2764
+ };
2765
+ function model3dMime(filename) {
2766
+ return MODEL_3D_MIMES[extensionOf(filename)] ?? "application/octet-stream";
2767
+ }
2768
+ //#endregion
2769
+ //#region src/runner/historyReplay.ts
2770
+ const END_TYPES = /* @__PURE__ */ new Set([
2771
+ "execution_success",
2772
+ "execution_error",
2773
+ "execution_interrupted"
2774
+ ]);
2775
+ /** a prompt's `GET /history/<id>` reply as the ws messages a client missed. Null while the host has no
2776
+ * entry for it: queued, running, or lost */
2777
+ function historyReplay(json, promptId) {
2778
+ const entry = field(json, promptId);
2779
+ if (entry == null) return null;
2780
+ const problems = [];
2781
+ const valid = (raw) => {
2782
+ const res = types$1.PromptRelated_WsMsg(raw);
2783
+ if (!(res instanceof type.errors)) return res;
2784
+ problems.push(`${JSON.stringify(raw).slice(0, 200)}: ${res.summary}`);
2785
+ return null;
2786
+ };
2787
+ const executed = [];
2788
+ const outputs = field(entry, "outputs");
2789
+ if (typeof outputs === "object" && outputs != null) for (const [node, output] of Object.entries(outputs)) {
2790
+ const msg = valid({
2791
+ type: "executed",
2792
+ data: {
2793
+ node,
2794
+ output,
2795
+ prompt_id: promptId
2796
+ }
2797
+ });
2798
+ if (msg != null) executed.push(msg);
2799
+ }
2800
+ const status = field(entry, "status");
2801
+ const list = field(status, "messages");
2802
+ let end = null;
2803
+ for (const m of Array.isArray(list) ? list : []) {
2804
+ if (!Array.isArray(m) || typeof m[0] !== "string" || !END_TYPES.has(m[0])) continue;
2805
+ end = valid({
2806
+ type: m[0],
2807
+ data: m[1]
2808
+ });
2809
+ }
2810
+ const statusStr = field(status, "status_str");
2811
+ if (end == null && (status == null || statusStr === "success")) end = valid({
2812
+ type: "execution_success",
2813
+ data: {
2814
+ prompt_id: promptId,
2815
+ timestamp: Date.now()
2816
+ }
2817
+ });
2818
+ return {
2819
+ executed,
2820
+ end,
2821
+ problems
2822
+ };
2823
+ }
2824
+ function field(x, key) {
2825
+ if (typeof x !== "object" || x == null) return null;
2826
+ return Reflect.get(x, key) ?? null;
2827
+ }
2828
+ //#endregion
2829
+ //#region src/utils/log.ts
2830
+ const isQuiet = () => process.env.COMFY_TS_QUIET === "1";
2831
+ const logInfo = (msg) => {
2832
+ if (!isQuiet()) console.log(msg);
2833
+ };
2834
+ const logError = (msg) => console.error(`[comfy-ts] 🔴 ${msg}`);
2835
+ const logSuccess = (msg) => console.log(`[comfy-ts] 🟢 ${msg}`);
2836
+ //#endregion
2745
2837
  //#region src/runner/ComfyExecution.ts
2746
2838
  /** paths claimed by in-flight retrievals: two same-second runs on a
2747
2839
  * counter-resetting cloud host compute the same name before either writes.
@@ -2768,6 +2860,9 @@ var ComfyExecution = class {
2768
2860
  this._resolve = resolve;
2769
2861
  });
2770
2862
  this.onPromptRelatedMessage = (msg) => {
2863
+ if (this.ended) return;
2864
+ this.heard();
2865
+ if (msg.type === "execution_success" || msg.type === "execution_error" || msg.type === "execution_interrupted") this.ended = true;
2771
2866
  const graph = this.workflow;
2772
2867
  if (msg.type === "binary_preview_frame") {
2773
2868
  if (this.wsOutputNodeExecuting) this.onWsImageOutput({
@@ -2798,6 +2893,7 @@ var ComfyExecution = class {
2798
2893
  this.workflow.onExecuting(msg);
2799
2894
  };
2800
2895
  this.onExecutionSuccess = async (_msg) => {
2896
+ if (this.mayHaveMissedEvents) await this.retrieveMissedOutputs();
2801
2897
  await Promise.all(this.pendingPromises);
2802
2898
  return this._finish({ status: "Success" });
2803
2899
  };
@@ -2811,6 +2907,7 @@ var ComfyExecution = class {
2811
2907
  };
2812
2908
  this.onExecuted = (msg) => {
2813
2909
  const promptNodeID = msg.data.node;
2910
+ this.heardExecuted.add(promptNodeID);
2814
2911
  for (const entry of msg.data.output?.text ?? []) {
2815
2912
  if (typeof entry !== "string") continue;
2816
2913
  const nodeKey = this.workflow.data.apiJson?.[promptNodeID]?.class_type ?? null;
@@ -2826,7 +2923,7 @@ var ComfyExecution = class {
2826
2923
  ...out?.video ?? [],
2827
2924
  ...out?.gifs ?? []
2828
2925
  ].filter((f) => f.type !== "input");
2829
- for (const video of listed.filter((f) => isVideoFilename(f.filename))) this.pendingPromises.push(this.retrieveFile("video", video, promptNodeID).catch((e) => {
2926
+ for (const video of listed.filter((f) => isVideoFilename(f.filename))) this.pendingPromises.push(this.retrieveFile(video, promptNodeID, mediaMime(video.filename)).then((o) => void this.videos.push(o), (e) => {
2830
2927
  console.error(`🔴 failed to retrieve ${video.filename}:`, e);
2831
2928
  this.videoErrors.push({
2832
2929
  video,
@@ -2841,35 +2938,118 @@ var ComfyExecution = class {
2841
2938
  error: e
2842
2939
  });
2843
2940
  }));
2844
- for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.retrieveFile("audio", audio, promptNodeID).catch((e) => {
2941
+ for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.retrieveFile(audio, promptNodeID, mediaMime(audio.filename)).then((o) => void this.audios.push(o), (e) => {
2845
2942
  console.error(`🔴 failed to retrieve ${audio.filename}:`, e);
2846
2943
  this.audioErrors.push({
2847
2944
  audio,
2848
2945
  error: e
2849
2946
  });
2850
2947
  }));
2948
+ for (const model3d of (out?.["3d"] ?? []).filter((f) => f.type !== "input")) this.pendingPromises.push(this.retrieveFile(model3d, promptNodeID, model3dMime(model3d.filename)).then((o) => void this.models3d.push({
2949
+ ...o,
2950
+ format: extensionOf(o.filename)
2951
+ }), (e) => {
2952
+ console.error(`🔴 failed to retrieve ${model3d.filename}:`, e);
2953
+ this.models3dErrors.push({
2954
+ model3d,
2955
+ error: e
2956
+ });
2957
+ }));
2851
2958
  };
2852
2959
  this.pendingPromises = [];
2960
+ this.ended = false;
2961
+ this.heardExecuted = /* @__PURE__ */ new Set();
2962
+ this.mayHaveMissedEvents = false;
2963
+ this.historyRetry = {
2964
+ tries: 5,
2965
+ ms: 400
2966
+ };
2967
+ this.retrieveMissedOutputs = async () => {
2968
+ const id = this.data.id;
2969
+ for (let i = 0; i < this.historyRetry.tries; i++) {
2970
+ if (this.host.reconcileOff != null) return;
2971
+ if (i > 0) await new Promise((r) => setTimeout(r, this.historyRetry.ms));
2972
+ try {
2973
+ const replay = historyReplay(await this.host.fetchHistory(id), id);
2974
+ if (replay == null) continue;
2975
+ return this.replayUnheardOutputs(replay);
2976
+ } catch (e) {
2977
+ if (this.host.noteReconcileFailure(e)) return;
2978
+ return logError(`run ${id}: its history did not answer (${extractErrorMessage(e)}); an output sent while the socket was down may be missing`);
2979
+ }
2980
+ }
2981
+ logError(`run ${id}: no history entry after its end; an output sent while the socket was down may be missing`);
2982
+ };
2983
+ this.lastHeardAt = Date.now();
2984
+ this.reconciling = false;
2985
+ this.loggedReconcileProblems = /* @__PURE__ */ new Set();
2986
+ this.reconcile = async (queued) => {
2987
+ const id = this.data.id;
2988
+ const hostId = this.host.data.id;
2989
+ try {
2990
+ if (this.ended || queued?.has(id) === true) return "waiting";
2991
+ let replay;
2992
+ try {
2993
+ replay = historyReplay(await this.host.fetchHistory(id), id);
2994
+ } catch (e) {
2995
+ if (!this.host.noteReconcileFailure(e)) this.logReconcileOnce(`the history of host '${hostId}' did not answer (${extractErrorMessage(e)}); waiting for its events`);
2996
+ return "waiting";
2997
+ }
2998
+ if (this.ended) return "waiting";
2999
+ if (replay == null) {
3000
+ if (queued == null) return "waiting";
3001
+ const reason = `host '${hostId}' has it neither in its queue nor in its history (cancelled, or the host restarted)`;
3002
+ logError(`run ${id}: ${reason}; the run fails`);
3003
+ this.ended = true;
3004
+ await this._finish({
3005
+ status: "Failure",
3006
+ error: null,
3007
+ reason
3008
+ });
3009
+ return "lost";
3010
+ }
3011
+ const sinceHeard = Date.now() - this.lastHeardAt;
3012
+ if (!this.mayHaveMissedEvents && this.sendsWsFrames && sinceHeard < this.host.runSilenceMaxMs) return "waiting";
3013
+ logInfo(`run ${id}: ended on host '${hostId}' without its end reaching the socket, finishing from its history`);
3014
+ for (const p of replay.problems) logError(`run ${id}: a history entry does not match the ws schemas, skipped: ${p}`);
3015
+ this.replayUnheardOutputs(replay);
3016
+ if (this.ephemeral) logError(`run ${id}: SaveImageWebsocket frames sent while the socket did not hear are lost (they never reach the server disk)`);
3017
+ if (replay.end != null) {
3018
+ this.onPromptRelatedMessage(replay.end);
3019
+ return "history";
3020
+ }
3021
+ const reason = `its history entry on host '${hostId}' carries no end message`;
3022
+ logError(`run ${id}: ${reason}; the run fails`);
3023
+ this.ended = true;
3024
+ await this._finish({
3025
+ status: "Failure",
3026
+ error: null,
3027
+ reason
3028
+ });
3029
+ return "history";
3030
+ } finally {
3031
+ this.reconciling = false;
3032
+ }
3033
+ };
2853
3034
  this.audioErrors = [];
2854
3035
  this.audios = [];
2855
3036
  this.videoErrors = [];
2856
3037
  this.videos = [];
2857
- this.retrieveFile = async (kind, info, promptNodeID) => {
3038
+ this.models3dErrors = [];
3039
+ this.models3d = [];
3040
+ this.retrieveFile = async (info, promptNodeID, mime) => {
2858
3041
  const response = await this.host.fetchFile("/view?" + new URLSearchParams(info).toString());
2859
3042
  const bytes = new Uint8Array(await response.arrayBuffer());
2860
- const mime = mediaMime(info.filename);
2861
- const list = kind === "audio" ? this.audios : this.videos;
3043
+ const tags = this.tagsOf(promptNodeID);
2862
3044
  const sf = this.save;
2863
- if (sf == null) {
2864
- list.push({
2865
- nodeId: promptNodeID,
2866
- filename: info.filename,
2867
- mime,
2868
- bytes,
2869
- absPath: null
2870
- });
2871
- return;
2872
- }
3045
+ if (sf == null) return {
3046
+ nodeId: promptNodeID,
3047
+ filename: info.filename,
3048
+ mime,
3049
+ bytes,
3050
+ absPath: null,
3051
+ tags
3052
+ };
2873
3053
  const promptPrefix = this.workflow.data.apiJson?.[promptNodeID]?.inputs["filename_prefix"];
2874
3054
  const written = await this.encodeAndWrite({
2875
3055
  bytes,
@@ -2881,13 +3061,14 @@ var ComfyExecution = class {
2881
3061
  subfolder: info.subfolder,
2882
3062
  filename: info.filename
2883
3063
  });
2884
- list.push({
3064
+ return {
2885
3065
  nodeId: promptNodeID,
2886
3066
  filename: info.filename,
2887
3067
  mime,
2888
3068
  bytes,
2889
- absPath: written.path
2890
- });
3069
+ absPath: written.path,
3070
+ tags
3071
+ };
2891
3072
  };
2892
3073
  this.imageErrors = [];
2893
3074
  this.retrieveImage = async (comfyImageInfo, promptNodeID) => {
@@ -2965,6 +3146,7 @@ var ComfyExecution = class {
2965
3146
  };
2966
3147
  };
2967
3148
  this.onWsImageOutput = (p) => {
3149
+ this.heard();
2968
3150
  const promptNodeID = this.workflow.currentExecutingNode?.uid ?? null;
2969
3151
  this.pendingPromises.push(this.storeWsImage(p, promptNodeID).catch((e) => {
2970
3152
  console.error(`🔴 failed to store a SaveImageWebsocket output:`, e);
@@ -3027,7 +3209,7 @@ var ComfyExecution = class {
3027
3209
  this.onProgress = init.onProgress ?? null;
3028
3210
  this.onPreview = init.onPreview ?? null;
3029
3211
  this.logProgress = init.logProgress ?? false;
3030
- this.host.executions.set(data.id, this);
3212
+ this.host.trackExecution(this);
3031
3213
  this.onCreate();
3032
3214
  }
3033
3215
  get progress() {
@@ -3063,6 +3245,7 @@ var ComfyExecution = class {
3063
3245
  const outputs = [`${this.images.length} image(s)`];
3064
3246
  if (this.audios.length > 0) outputs.push(`${this.audios.length} audio(s)`);
3065
3247
  if (this.videos.length > 0) outputs.push(`${this.videos.length} video(s)`);
3248
+ if (this.models3d.length > 0) outputs.push(`${this.models3d.length} 3d model(s)`);
3066
3249
  if (this.texts.length > 0) outputs.push(`${this.texts.length} text(s)`);
3067
3250
  const line = `${this.status === "Failure" ? "🔴" : "🟢"} ${this.status.toLowerCase()} in ${(p.elapsedMs / 1e3).toFixed(1)}s · ${outputs.join(" · ")}`;
3068
3251
  if (globalThis.process?.stdout?.isTTY) process.stdout.write(`\r\x1b[2K${line}\n`);
@@ -3091,13 +3274,39 @@ var ComfyExecution = class {
3091
3274
  get status() {
3092
3275
  return this.data.status ?? "New";
3093
3276
  }
3277
+ replayUnheardOutputs(replay) {
3278
+ for (const msg of replay.executed) if (msg.type === "executed" && !this.heardExecuted.has(msg.data.node)) this.onExecuted(msg);
3279
+ }
3280
+ heard() {
3281
+ this.lastHeardAt = Date.now();
3282
+ }
3283
+ logReconcileOnce(msg) {
3284
+ if (this.loggedReconcileProblems.has(msg)) return;
3285
+ this.loggedReconcileProblems.add(msg);
3286
+ logError(`run ${this.data.id}: ${msg}`);
3287
+ }
3288
+ /** @internal called before the host reads its queue. After a reconnect the run may have lost events,
3289
+ * so its end reads /history for them; the flag is set before any await, so a live end that lands
3290
+ * during the reads still looks. A check for silence alone does not set it: a quiet run lost nothing */
3291
+ beginReconcile(why) {
3292
+ this.reconciling = true;
3293
+ if (why === "reconnect") this.mayHaveMissedEvents = true;
3294
+ }
3094
3295
  /** accumulate an output on the prompt; tags from node metadata ride along */
3095
3296
  pushImage(img, promptNodeID) {
3096
- const promptMeta = promptNodeID != null ? this.workflow.data.metadata?.[promptNodeID] : null;
3097
- if (promptMeta?.tag) img.tags.push(promptMeta.tag);
3098
- if (promptMeta?.tags) img.tags.push(...promptMeta.tags);
3297
+ img.tags.push(...this.tagsOf(promptNodeID));
3099
3298
  this.images.push(img);
3100
3299
  }
3300
+ /** the tags an output node was built with (`{ tag }` / `{ tags }` metadata) */
3301
+ tagsOf(promptNodeID) {
3302
+ const promptMeta = promptNodeID != null ? this.workflow.data.metadata?.[promptNodeID] : null;
3303
+ return [...promptMeta?.tag ? [promptMeta.tag] : [], ...promptMeta?.tags ?? []];
3304
+ }
3305
+ /** the sent graph saves through SaveImageWebsocket: those outputs exist only as ws frames */
3306
+ get sendsWsFrames() {
3307
+ const apiJson = this.snapshot?.apiJson ?? this.workflow.apiJson;
3308
+ return Object.values(apiJson).some((n) => n?.class_type === "SaveImageWebsocket");
3309
+ }
3101
3310
  /** true while the currently executing node is a SaveImageWebsocket in the
3102
3311
  * SENT snapshot (the ephemeral rewrite only touches the snapshot, so the
3103
3312
  * live graph may still say SaveImage) — binary frames are then OUTPUTS */
@@ -3109,6 +3318,7 @@ var ComfyExecution = class {
3109
3318
  /** @internal a live preview frame of this run; never an output (the host routes ws saver frames
3110
3319
  * to onWsImageOutput before they get here) */
3111
3320
  onPreviewFrame(p) {
3321
+ this.heard();
3112
3322
  const listener = this.onPreview;
3113
3323
  if (listener == null) return;
3114
3324
  const current = this.workflow.currentExecutingNode;
@@ -3130,6 +3340,7 @@ var ComfyExecution = class {
3130
3340
  }
3131
3341
  /** @internal a live-text frame for one node */
3132
3342
  onProgressText(p) {
3343
+ this.heard();
3133
3344
  this.progressTexts.set(p.nodeId, p.text);
3134
3345
  this.progressText = p.text;
3135
3346
  this.emitProgress();
@@ -3143,6 +3354,35 @@ var ComfyExecution = class {
3143
3354
  }
3144
3355
  };
3145
3356
  //#endregion
3357
+ //#region src/runner/comfyOrgApiKey.ts
3358
+ /** the prompt holds a paid partner node and no Comfy account key was set */
3359
+ var ComfyOrgApiKeyMissingError = class extends Error {
3360
+ constructor(hostId, nodes) {
3361
+ const list = nodes.map((n) => `${n.classType} #${n.id}`).join(", ");
3362
+ super(`🔴 host '${hostId}': the prompt holds partner API node(s) ${list}, which bill a Comfy account, and no Comfy account key is set. Set it with \`comfy.host({ id: '${hostId}', comfyOrgApiKey })\` or \`run({ comfyOrgApiKey })\` (a string or a thunk; the key comes from platform.comfy.org). Nothing was sent.`);
3363
+ this.hostId = hostId;
3364
+ this.nodes = nodes;
3365
+ this.name = "ComfyOrgApiKeyMissingError";
3366
+ }
3367
+ };
3368
+ /** the nodes of a prompt whose schema says `api_node: true` */
3369
+ const partnerApiNodes = (apiJson, schema) => {
3370
+ const out = [];
3371
+ for (const [id, node] of Object.entries(apiJson)) if (schema.nodesByNameInComfy[node.class_type]?.raw.api_node === true) out.push({
3372
+ id,
3373
+ classType: node.class_type
3374
+ });
3375
+ return out;
3376
+ };
3377
+ /** the first source set wins; an empty string counts as unset */
3378
+ const resolveComfyOrgApiKey = async (sources) => {
3379
+ for (const src of sources) {
3380
+ if (src == null) continue;
3381
+ const key = typeof src === "string" ? src : await src();
3382
+ if (key != null && key !== "") return key;
3383
+ }
3384
+ };
3385
+ //#endregion
3146
3386
  //#region src/runner/ephemeral.ts
3147
3387
  /**
3148
3388
  * the `ephemeral: true` rewrite (architecture.md item 14): every SaveImage
@@ -3190,14 +3430,6 @@ function styler(open = "", close = "") {
3190
3430
  }
3191
3431
  const ansi = styler();
3192
3432
  //#endregion
3193
- //#region src/utils/log.ts
3194
- const isQuiet = () => process.env.COMFY_TS_QUIET === "1";
3195
- const logInfo = (msg) => {
3196
- if (!isQuiet()) console.log(msg);
3197
- };
3198
- const logError = (msg) => console.error(`[comfy-ts] 🔴 ${msg}`);
3199
- const logSuccess = (msg) => console.log(`[comfy-ts] 🟢 ${msg}`);
3200
- //#endregion
3201
3433
  //#region src/utils/printArkResultInConsole.ts
3202
3434
  const MAX_PRINTED_ERRORS = 10;
3203
3435
  function printArkResultInConsole(res) {
@@ -3310,6 +3542,8 @@ function comfyWorkflowAutoLayout(p) {
3310
3542
  }
3311
3543
  //#endregion
3312
3544
  //#region src/runner/ComfyWorkflow.ts
3545
+ /** a Comfy Cloud host's X-API-Key is a platform.comfy.org key, the one partner nodes bill to */
3546
+ const COMFY_CLOUD_HOST = "cloud.comfy.org";
3313
3547
  const asComfyWorkflowID = (x) => x;
3314
3548
  var ComfyWorkflow = class {
3315
3549
  constructor(host, data) {
@@ -3440,14 +3674,29 @@ var ComfyWorkflow = class {
3440
3674
  const hasWsSaver = Object.values(snapshot.apiJson).some((n) => n.class_type === "SaveImageWebsocket");
3441
3675
  if (rewritten === 0 && !hasWsSaver) console.warn(`🟡 ephemeral run: no SaveImage/SaveImageWebsocket node in workflow '${this.id}' — nothing streams back`);
3442
3676
  }
3677
+ const partners = partnerApiNodes(snapshot.apiJson, this.schema);
3678
+ let comfyOrgApiKey;
3679
+ if (partners.length > 0) {
3680
+ const data = this.host.data;
3681
+ const cloudKey = data.apiKey != null && this.host.base.host === COMFY_CLOUD_HOST ? data.apiKey : void 0;
3682
+ comfyOrgApiKey = await resolveComfyOrgApiKey([
3683
+ p.comfyOrgApiKey,
3684
+ data.comfyOrgApiKey,
3685
+ cloudKey
3686
+ ]);
3687
+ if (comfyOrgApiKey == null) throw new ComfyOrgApiKeyMissingError(data.id, partners);
3688
+ }
3443
3689
  const out = {
3444
3690
  client_id: this.host.comfySessionId,
3445
3691
  prompt: snapshot.apiJson,
3446
- extra_data: { extra_pnginfo: {
3447
- workflow: snapshot.workflowJson,
3448
- comfy_ts_workflow_id: this.id,
3449
- comfy_ts_version: comfyts.version
3450
- } }
3692
+ extra_data: {
3693
+ extra_pnginfo: {
3694
+ workflow: snapshot.workflowJson,
3695
+ comfy_ts_workflow_id: this.id,
3696
+ comfy_ts_version: comfyts.version
3697
+ },
3698
+ ...comfyOrgApiKey != null ? { api_key_comfy_org: comfyOrgApiKey } : {}
3699
+ }
3451
3700
  };
3452
3701
  const res = await this.host.fetch("/prompt", {
3453
3702
  method: "POST",
@@ -3886,7 +4135,12 @@ function codegenSDK(opts) {
3886
4135
  p(`INVALID_null: any`);
3887
4136
  p("");
3888
4137
  p("// named slot types: everything an input of that type accepts");
3889
- for (const t of slotTypes) p(`${escapeJSKey(t.comfyType)}: ${t.tsType} | HasSingle['${t.comfyType}'] | ((x: Producer['${t.comfyType}']) => Accepts['${t.comfyType}'])`);
4138
+ const slotTypeNames = new Set(slotTypes.map((t) => t.comfyType));
4139
+ for (const t of slotTypes) {
4140
+ const own = `${t.tsType} | HasSingle['${t.comfyType}'] | ((x: Producer['${t.comfyType}']) => Accepts['${t.comfyType}'])`;
4141
+ const anyOf = (t.comfyType.includes(",") ? t.comfyType.split(",").map((s) => s.trim()) : []).map((part) => slotTypeNames.has(part) ? `Accepts['${part}']` : `ComfyNodeOutput<'${part}'>`);
4142
+ p(`${escapeJSKey(t.comfyType)}: ${[own, ...anyOf].join(" | ")}`);
4143
+ }
3890
4144
  p("");
3891
4145
  p("// enum unions: literal values or an output carrying one");
3892
4146
  for (const t of this.knownUnionByHash.values()) p(`${escapeJSKey(t.unionName)}: Union['${t.unionName}'] | ComfyNodeOutput<'${t.unionName}'>`);
@@ -4217,7 +4471,8 @@ const types = scope({
4217
4471
  output_node: "boolean",
4218
4472
  "output_tooltips?": "(string | null)[]",
4219
4473
  "deprecated?": "boolean",
4220
- "experimental?": "boolean"
4474
+ "experimental?": "boolean",
4475
+ "api_node?": "boolean"
4221
4476
  },
4222
4477
  ComfyInputSpecAlt1: ["ComfyInputType", "ComfyInputOpts"],
4223
4478
  ComfyInputSpecAlt2: ["ComfyInputType"],
@@ -5177,6 +5432,12 @@ var ResilientWebSocketClient = class {
5177
5432
  }
5178
5433
  }, ms);
5179
5434
  }
5435
+ /** close the socket cleanly, then reconnect as after any close: the server ends its handler first */
5436
+ reconnect() {
5437
+ if (this.permanentlyClosed || this.currentWS == null) return;
5438
+ this.addInfo("closing the socket to reconnect");
5439
+ this.currentWS.close();
5440
+ }
5180
5441
  /** close and stop reconnecting (lets a script exit cleanly) */
5181
5442
  disconnectPermanently() {
5182
5443
  this.permanentlyClosed = true;
@@ -5198,6 +5459,7 @@ var ResilientWebSocketClient = class {
5198
5459
  }
5199
5460
  async connect() {
5200
5461
  this.isOpen = false;
5462
+ this.url = this.options.url();
5201
5463
  const prevWS = this.currentWS;
5202
5464
  if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
5203
5465
  this.stopHeartbeat();
@@ -6737,7 +6999,8 @@ var DefinedWorkflow = class {
6737
6999
  idMode: settings.idMode,
6738
7000
  log: settings.log,
6739
7001
  onProgress: settings.onProgress,
6740
- onPreview: settings.onPreview
7002
+ onPreview: settings.onPreview,
7003
+ comfyOrgApiKey: settings.comfyOrgApiKey
6741
7004
  });
6742
7005
  this.lastExecution = execution;
6743
7006
  return execution;
@@ -6829,10 +7092,17 @@ function diffSchemas(p) {
6829
7092
  }
6830
7093
  //#endregion
6831
7094
  //#region src/host/ComfyHost.ts
6832
- /** the host never came up within ConnectOptions.timeoutMs */
6833
- var ComfyHostUnreachableError = class extends Error {
7095
+ /** the host answered a run check route, but not as ComfyUI does (no such route, another shape) */
7096
+ var HostRouteUnusableError = class extends Error {
6834
7097
  constructor(..._args) {
6835
7098
  super(..._args);
7099
+ this.name = "HostRouteUnusableError";
7100
+ }
7101
+ };
7102
+ /** the host never came up within ConnectOptions.timeoutMs */
7103
+ var ComfyHostUnreachableError = class extends Error {
7104
+ constructor(..._args2) {
7105
+ super(..._args2);
6836
7106
  this.name = "ComfyHostUnreachableError";
6837
7107
  }
6838
7108
  };
@@ -7005,6 +7275,7 @@ var ComfyHost = class {
7005
7275
  this._connectTimer = null;
7006
7276
  this.disconnect = () => {
7007
7277
  this.clearConnectTimer();
7278
+ this.stopWatchdog();
7008
7279
  this.ws?.disconnectPermanently();
7009
7280
  this.ws = null;
7010
7281
  this._ready = null;
@@ -7024,6 +7295,50 @@ var ComfyHost = class {
7024
7295
  });
7025
7296
  if (!res.ok) throw new Error(`POST ${route} failed on ${this.getServerHostHTTP()}: ${res.status}`);
7026
7297
  };
7298
+ this.fetchReconcileJSON_ = async (route) => {
7299
+ const res = await this.fetch(route);
7300
+ const contentType = res.headers.get("content-type") ?? "";
7301
+ if (res.ok && contentType.includes("json")) return res.json();
7302
+ res.body?.cancel();
7303
+ throw new HostRouteUnusableError(`GET ${route} answered ${res.status} ${contentType || "no content-type"}`);
7304
+ };
7305
+ this.fetchHistory = (promptId) => {
7306
+ return this.fetchReconcileJSON_(`/history/${encodeURIComponent(promptId)}`);
7307
+ };
7308
+ this.fetchQueuedPromptIds = async () => {
7309
+ const json = await this.fetchReconcileJSON_("/queue");
7310
+ const ids = /* @__PURE__ */ new Set();
7311
+ for (const key of ["queue_running", "queue_pending"]) {
7312
+ const list = typeof json === "object" && json != null ? Reflect.get(json, key) : null;
7313
+ if (!Array.isArray(list)) throw new HostRouteUnusableError(`GET /queue has no ${key} list`);
7314
+ for (const item of list) {
7315
+ if (!Array.isArray(item) || typeof item[1] !== "string") throw new HostRouteUnusableError(`GET /queue: an item of ${key} is not [number, prompt_id, …]`);
7316
+ ids.add(item[1]);
7317
+ }
7318
+ }
7319
+ return ids;
7320
+ };
7321
+ this.reconcileOff = null;
7322
+ this.fetchQueuedPromptIdsOrNull = async () => {
7323
+ try {
7324
+ return await this.fetchQueuedPromptIds();
7325
+ } catch (e) {
7326
+ if (this.noteReconcileFailure(e)) return null;
7327
+ const msg = extractErrorMessage(e);
7328
+ if (!this._loggedQueueProblems.has(msg)) {
7329
+ this._loggedQueueProblems.add(msg);
7330
+ logError(`host '${this.data.id}': its queue did not answer (${msg}); no run is failed as lost until it does`);
7331
+ }
7332
+ return null;
7333
+ }
7334
+ };
7335
+ this._loggedQueueProblems = /* @__PURE__ */ new Set();
7336
+ this.runSilenceMs = 1e3;
7337
+ this.runSilenceMaxMs = 3e4;
7338
+ this._silenceWaitMs = null;
7339
+ this._lastCheckAt = 0;
7340
+ this._checking = false;
7341
+ this._watchdog = null;
7027
7342
  this.clearQueue = () => {
7028
7343
  return this.postJSON_("/queue", { clear: true });
7029
7344
  };
@@ -7153,6 +7468,7 @@ var ComfyHost = class {
7153
7468
  this.comfySessionId = "temp";
7154
7469
  this._unknownBinaryFrameTypes = /* @__PURE__ */ new Set();
7155
7470
  this._unknownWsEventTypes = /* @__PURE__ */ new Set();
7471
+ this._socketIsNew = false;
7156
7472
  this.status = null;
7157
7473
  this.lastWsMessageAt = null;
7158
7474
  /** folder where file related to the host config will be cached */
@@ -7258,6 +7574,8 @@ var ComfyHost = class {
7258
7574
  this.ws = new ResilientWebSocketClient({
7259
7575
  onConnectOrReconnect: async () => {
7260
7576
  logInfo(`[👢] WEBSOCKET: connected to ComfyUI host ${this.data.id}`);
7577
+ this._socketIsNew = true;
7578
+ this.reconcileRuns([...this.executions.values()], "reconnect");
7261
7579
  if (this.shouldUseSchemaCache()) try {
7262
7580
  await this.loadSchemaFromCache();
7263
7581
  await this.waitForSession();
@@ -7271,7 +7589,7 @@ var ComfyHost = class {
7271
7589
  this.markReady();
7272
7590
  },
7273
7591
  onMessage: (e) => this.onMessage(e),
7274
- url: () => this.getWSUrl(),
7592
+ url: () => this.comfySessionId === "temp" ? this.getWSUrl() : `${this.getWSUrl()}?clientId=${encodeURIComponent(this.comfySessionId)}`,
7275
7593
  headers: () => this.authHeaders(),
7276
7594
  onTransportDead: (e) => this.markFailed(e),
7277
7595
  onFirstConnectFailed: (e) => this.markFailed(new ComfyHostUnreachableError(`host '${this.data.id}' is not reachable at ${this.getWSUrl()} — ${extractErrorMessage(e)}. Is ComfyUI running there ?`)),
@@ -7313,6 +7631,65 @@ var ComfyHost = class {
7313
7631
  });
7314
7632
  return this._schemaFromCache;
7315
7633
  }
7634
+ /** @internal a failed run check: true when it proved the host has no usable route (the checks then
7635
+ * stop for good, said once), false for a passing failure the caller reports */
7636
+ noteReconcileFailure(e) {
7637
+ if (!(e instanceof Error) || e.name !== "HostRouteUnusableError") return false;
7638
+ if (this.reconcileOff == null) {
7639
+ this.reconcileOff = e.message;
7640
+ this.stopWatchdog();
7641
+ logInfo(`host '${this.data.id}': ${e.message}, not the ComfyUI shape: runs here are not checked over http, they wait for their events`);
7642
+ }
7643
+ return true;
7644
+ }
7645
+ /** @internal a new run routes its ws messages here, and the watchdog watches it */
7646
+ trackExecution(execution) {
7647
+ this.executions.set(execution.data.id, execution);
7648
+ if (this.ws == null || this._watchdog != null || this.reconcileOff != null) return;
7649
+ this._watchdog = setInterval(() => this.watchdogTick(), Math.min(250, this.runSilenceMs));
7650
+ this._watchdog.unref?.();
7651
+ }
7652
+ stopWatchdog() {
7653
+ if (this._watchdog != null) clearInterval(this._watchdog);
7654
+ this._watchdog = null;
7655
+ }
7656
+ /** a socket that hears no broadcast and no event for a while is deaf, or the host runs one long
7657
+ * quiet node: ask. A run queued behind a talking host is never asked about */
7658
+ watchdogTick() {
7659
+ if (this.executions.size === 0 || this.ws == null) return this.stopWatchdog();
7660
+ if (this._checking) return;
7661
+ const now = Date.now();
7662
+ const wait = this._silenceWaitMs ?? this.runSilenceMs;
7663
+ if (now - Math.max(this.lastWsMessageAt ?? 0, this._lastCheckAt) < wait) return;
7664
+ const due = [...this.executions.values()].filter((e) => !e.reconciling && now - e.lastHeardAt >= this.runSilenceMs);
7665
+ if (due.length === 0) return;
7666
+ this._checking = true;
7667
+ this.reconcileRuns(due, "silence").finally(() => {
7668
+ this._checking = false;
7669
+ this._lastCheckAt = Date.now();
7670
+ this._silenceWaitMs = Math.min(wait * 2, this.runSilenceMaxMs);
7671
+ });
7672
+ }
7673
+ /** @internal one queue read for all the runs, then the history of each run not in it. A run that
7674
+ * ends from its history while the socket looked fine means the socket hears nothing: ComfyUI removes
7675
+ * a session BY KEY when a socket's handler ends, so an old handler that ends after a reconnect evicts
7676
+ * the new socket of the same session. A clean close lets the server end that handler first */
7677
+ async reconcileRuns(runs, why) {
7678
+ if (this.reconcileOff != null) return;
7679
+ const todo = runs.filter((r) => !r.reconciling);
7680
+ if (todo.length === 0) return;
7681
+ for (const r of todo) r.beginReconcile(why);
7682
+ const queued = await this.fetchQueuedPromptIdsOrNull();
7683
+ if (this.reconcileOff != null) {
7684
+ for (const r of todo) r.reconciling = false;
7685
+ return;
7686
+ }
7687
+ const verdicts = await Promise.all(todo.map((r) => r.reconcile(queued)));
7688
+ if (why === "silence" && verdicts.includes("history") && this.ws?.isOpen === true) {
7689
+ logError(`host '${this.data.id}': a run ended without its end reaching the socket, which hears nothing; reconnecting`);
7690
+ this.ws.reconnect();
7691
+ }
7692
+ }
7316
7693
  /** method to either execute or buffer the incoming message */
7317
7694
  routeOrBuffer(prompt_id, msg) {
7318
7695
  this.activePromptID = prompt_id;
@@ -7374,6 +7751,7 @@ var ComfyHost = class {
7374
7751
  }
7375
7752
  onMessage(e) {
7376
7753
  this.lastWsMessageAt = Date.now();
7754
+ this._silenceWaitMs = null;
7377
7755
  if (this.data.onWsMessageAny) this.data.onWsMessageAny(e);
7378
7756
  if (e.data instanceof ArrayBuffer) {
7379
7757
  if (isPreviewFrameType(binaryFrameType(e.data))) return this.onPreviewFrame(e.data);
@@ -7425,10 +7803,12 @@ var ComfyHost = class {
7425
7803
  if (msg.type === "status") {
7426
7804
  if (msg.data.sid) {
7427
7805
  const sidChanged = msg.data.sid !== this.comfySessionId;
7806
+ const socketIsNew = this._socketIsNew;
7807
+ this._socketIsNew = false;
7428
7808
  this.comfySessionId = msg.data.sid;
7429
7809
  this._sessionResolve?.();
7430
7810
  this._sessionResolve = null;
7431
- if (sidChanged) {
7811
+ if (sidChanged || socketIsNew) {
7432
7812
  this._unknownWsEventTypes.clear();
7433
7813
  this._unknownBinaryFrameTypes.clear();
7434
7814
  this.onSession?.(msg.data.sid);
@@ -8114,6 +8494,7 @@ var ComfyTS = class ComfyTS {
8114
8494
  const authed = (p) => p.apiKey != null ? " (authed)" : "";
8115
8495
  throw new Error(`host id '${data.id}' already registered ${cur == null ? "with no address" : `at ${renderHttpBase(cur)}`}${authed(existing.data)} — refusing ${incoming == null ? "the id alone" : renderHttpBase(incoming)}${authed(data)}`);
8116
8496
  }
8497
+ if (data.comfyOrgApiKey != null) existing.data.comfyOrgApiKey = data.comfyOrgApiKey;
8117
8498
  return existing;
8118
8499
  }
8119
8500
  const created = new ComfyHost(data);
@@ -8318,6 +8699,6 @@ function isTuiActive() {
8318
8699
  */
8319
8700
  setDefaultComfyStorage(createNodeStorage());
8320
8701
  //#endregion
8321
- export { AudioVar, ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, MediaVar, MediaVarEmptyError, MultiChoiceVar, OptionalChoiceVar, PromptVar, ResilientWebSocketClient, SD15_SIZE_PRESETS, SeedVar, SizeVar, TextVar, ToggleVar, VideoVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resolveWidgetRoles, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v, widget };
8702
+ export { AudioVar, ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfyOrgApiKeyMissingError, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, MediaVar, MediaVarEmptyError, MultiChoiceVar, OptionalChoiceVar, PromptVar, ResilientWebSocketClient, SD15_SIZE_PRESETS, SeedVar, SizeVar, TextVar, ToggleVar, VideoVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resolveWidgetRoles, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v, widget };
8322
8703
 
8323
8704
  //# sourceMappingURL=index.js.map