comfy-ts 2.11.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{LogsSt-qtFzOKpu.js → LogsSt-CUeo843w.js} +51 -7
- package/dist/LogsSt-CUeo843w.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/index.cjs +595 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +286 -46
- package/dist/index.d.ts +286 -46
- package/dist/index.js +591 -74
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-BK7BA2dn.js → run-serve-DlRBv_Nk.js} +738 -58
- package/dist/run-serve-DlRBv_Nk.js.map +1 -0
- package/dist/{run-tui-CQyvMf0N.js → run-tui-B5uxm2_l.js} +43 -18
- package/dist/run-tui-B5uxm2_l.js.map +1 -0
- package/dist/{schemaDrift-DjjEtwfx.js → schemaDrift-E95iTF7E.js} +473 -60
- package/dist/schemaDrift-E95iTF7E.js.map +1 -0
- package/dist/serve-web.js +710 -174
- package/dist/{state--wrz0BQc.js → state-CUp2J1Zy.js} +126 -14
- package/dist/state-CUp2J1Zy.js.map +1 -0
- package/dist/web.d.ts +286 -46
- package/dist/web.js +591 -74
- package/dist/web.js.map +1 -1
- package/examples/comfy-cloud/sdk.d.ts +163 -163
- package/examples/rvion/06-qwen-image-edit.cflow.ts +3 -2
- package/examples/rvion/10-anima-t2i.cflow.ts +252 -0
- package/examples/rvion/11-yue2-t2a.cflow.ts +105 -0
- package/examples/rvion/12-stable-audio-3-t2a.cflow.ts +78 -0
- package/examples/rvion/13-ace-step-15-xl-t2a.cflow.ts +153 -0
- package/examples/rvion/stableAudio3Prompts.ts +19 -0
- package/extra/README.md +4 -0
- package/extra/comfyui-fresh-model-lists/README.md +25 -0
- package/extra/comfyui-fresh-model-lists/__init__.py +36 -0
- package/extra/comfyui-fresh-model-lists/test_fresh_model_lists.py +97 -0
- package/package.json +15 -7
- package/src/cli/draftMeta.ts +39 -0
- package/src/cli/serve/ServeApp.ts +305 -30
- package/src/cli/serve/applyVarPayload.ts +50 -22
- package/src/cli/serve/byteRange.ts +48 -0
- package/src/cli/serve/describeVar.ts +42 -6
- package/src/cli/serve/llmConfigShape.ts +51 -0
- package/src/cli/serve/llmConfigs.ts +52 -0
- package/src/cli/serve/run-serve.ts +12 -3
- package/src/cli/serve/tagList.ts +92 -0
- package/src/cli/serve/tagSource.ts +69 -0
- package/src/cli/serve/web/api.ts +72 -0
- package/src/cli/serve/web/components/App.tsx +485 -44
- package/src/cli/serve/web/components/DraftTabs.tsx +167 -0
- package/src/cli/serve/web/components/Gallery.tsx +133 -31
- package/src/cli/serve/web/components/HistoryPicker.tsx +149 -0
- package/src/cli/serve/web/components/Icon.tsx +58 -2
- package/src/cli/serve/web/components/MenuButton.tsx +53 -0
- package/src/cli/serve/web/components/Omnibox.tsx +135 -0
- package/src/cli/serve/web/components/PromptEnhancer.tsx +476 -180
- package/src/cli/serve/web/components/SideMenu.tsx +414 -0
- package/src/cli/serve/web/components/TooltipLayer.tsx +46 -0
- package/src/cli/serve/web/components/VarIcon.tsx +24 -0
- package/src/cli/serve/web/components/VarsForm.tsx +223 -351
- package/src/cli/serve/web/components/controls/BasicControls.tsx +57 -32
- package/src/cli/serve/web/components/controls/LorasControl.tsx +646 -317
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +1 -1
- package/src/cli/serve/web/components/controls/PromptControl.tsx +279 -0
- package/src/cli/serve/web/components/controls/PromptEditor.tsx +113 -0
- package/src/cli/serve/web/components/controls/SeedControl.tsx +17 -10
- package/src/cli/serve/web/components/controls/SizeControl.tsx +111 -18
- package/src/cli/serve/web/components/modKey.ts +2 -0
- package/src/cli/serve/web/llm.ts +23 -12
- package/src/cli/serve/web/promptEditor/promptExtensions.ts +284 -0
- package/src/cli/serve/web/state/EnhancerSt.ts +431 -101
- package/src/cli/serve/web/state/FormSt.ts +214 -30
- package/src/cli/serve/web/state/OmniboxSt.ts +59 -0
- package/src/cli/serve/web/state/WebSt.ts +364 -80
- package/src/cli/serve/web/state/choiceButtons.ts +61 -0
- package/src/cli/serve/web/state/draftNames.ts +16 -0
- package/src/cli/serve/web/state/draftTabs.ts +75 -0
- package/src/cli/serve/web/state/generateButton.ts +16 -0
- package/src/cli/serve/web/state/history.ts +54 -0
- package/src/cli/serve/web/state/host.ts +5 -2
- package/src/cli/serve/web/state/keptLines.ts +53 -0
- package/src/cli/serve/web/state/latentMode.ts +20 -0
- package/src/cli/serve/web/state/loraSort.ts +18 -0
- package/src/cli/serve/web/state/moduleTree.ts +2 -2
- package/src/cli/serve/web/state/omnibox.ts +133 -0
- package/src/cli/serve/web/state/payload.ts +38 -58
- package/src/cli/serve/web/state/shortcuts.ts +103 -0
- package/src/cli/serve/web/state/sizeStars.ts +31 -0
- package/src/cli/serve/web/state/stableSlots.ts +21 -0
- package/src/cli/serve/web/state/varGroups.ts +24 -0
- package/src/cli/serve/web/styles.ts +653 -154
- package/src/cli/serve/webBundle.ts +54 -10
- package/src/cli/serve/workflowTags.ts +42 -0
- package/src/cli/serve/workspaceLabels.ts +23 -0
- package/src/cli/tui/components/PickerOverlays.tsx +9 -2
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +1 -1
- package/src/cli/tui/state/DraftsSt.ts +28 -8
- package/src/cli/tui/state/EditorSt.ts +1 -1
- package/src/cli/tui/state/LorasSt.ts +1 -1
- package/src/cli/tui/state/PickerSt.ts +25 -7
- package/src/cli/tui/state/SettingsSt.ts +1 -1
- package/src/cli/tui/state/TuiSt.ts +10 -0
- package/src/coreExports.ts +21 -0
- package/src/host/ComfyHost.ts +17 -2
- package/src/host/ResilientWebsocket.ts +54 -4
- package/src/host/loraInfoCache.ts +6 -0
- package/src/runner/ComfyExecution.ts +60 -0
- package/src/runner/ComfyWorkflow.ts +4 -0
- package/src/runner/ComfyWsApi.ts +2 -0
- package/src/runner/MediaImage.ts +2 -2
- package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +5 -5
- package/src/sdk-generator/comfyui-sdk-codegen.ts +1 -1
- package/src/state.ts +5 -0
- package/src/utils/copyName.ts +12 -0
- package/src/vars/ComfyVars.ts +337 -67
- package/src/vars/DefinedWorkflow.ts +47 -20
- package/src/vars/lanes.ts +238 -0
- package/src/vars/loraEntry.ts +101 -0
- package/src/vars/promptSyntax.ts +382 -0
- package/dist/LogsSt-qtFzOKpu.js.map +0 -1
- package/dist/run-serve-BK7BA2dn.js.map +0 -1
- package/dist/run-tui-CQyvMf0N.js.map +0 -1
- package/dist/schemaDrift-DjjEtwfx.js.map +0 -1
- package/dist/state--wrz0BQc.js.map +0 -1
- package/src/cli/serve/web/components/Sidebar.tsx +0 -66
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as ansi, a as DefinedWorkflow, at as isQuiet, ct as logSuccess, dt as sha1HexOfString, et as extractErrorMessage, it as resolveComfyStorage, lt as statelessRegex, n as diffSchemas, nt as bang, ot as logError, rt as getComfyStorage, st as logInfo, t as MODEL_LISTS, tt as isRecord$1, ut as sha1Hex } from "./schemaDrift-E95iTF7E.js";
|
|
2
2
|
import { basename, join } from "pathe";
|
|
3
3
|
import { scope, type } from "arktype";
|
|
4
4
|
import { nanoid } from "nanoid";
|
|
@@ -508,7 +508,7 @@ function codegenSDK(opts) {
|
|
|
508
508
|
p("}");
|
|
509
509
|
p(`interface Builder {`);
|
|
510
510
|
for (const n of nodes) {
|
|
511
|
-
const baseDescription = `displayName="${n.raw.display_name}" category="${n.category}" name="${n.nameInComfy}" output=[${n.outputs.map((o) => o.outKey).join(", ")}]`;
|
|
511
|
+
const baseDescription = `displayName="${n.raw.display_name ?? n.nameInComfy}" category="${n.category}" name="${n.nameInComfy}" output=[${n.outputs.map((o) => o.outKey).join(", ")}]`;
|
|
512
512
|
if (n.raw.description) {
|
|
513
513
|
p(` /**`);
|
|
514
514
|
p(n.raw.description.split("\n").map((i) => ` * ${i}`).join("\n"));
|
|
@@ -850,7 +850,7 @@ var ComfySchema = class {
|
|
|
850
850
|
};
|
|
851
851
|
//#endregion
|
|
852
852
|
//#region package.json
|
|
853
|
-
var version = "2.
|
|
853
|
+
var version = "2.13.0";
|
|
854
854
|
//#endregion
|
|
855
855
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
856
856
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -2412,6 +2412,7 @@ const types$1 = scope({
|
|
|
2412
2412
|
output: {
|
|
2413
2413
|
"previews?": [{ filepath: "string" }, "[]"],
|
|
2414
2414
|
"images?": "ComfyImageInfo[]",
|
|
2415
|
+
"audio?": "ComfyImageInfo[]",
|
|
2415
2416
|
"text?": "unknown[]"
|
|
2416
2417
|
},
|
|
2417
2418
|
prompt_id: "PromptID"
|
|
@@ -2512,11 +2513,11 @@ var MediaImage = class MediaImage {
|
|
|
2512
2513
|
});
|
|
2513
2514
|
};
|
|
2514
2515
|
this.loadInWorkflow_viaLoadImageNode = async (workflow) => {
|
|
2515
|
-
const enumName = await this.uploadAndReturnEnumName(workflow.host);
|
|
2516
|
+
const enumName = workflow.dry ? this.enumName : await this.uploadAndReturnEnumName(workflow.host);
|
|
2516
2517
|
return bang(workflow.builderBase.LoadImage, "host has no LoadImage node")({ image: enumName });
|
|
2517
2518
|
};
|
|
2518
2519
|
this.loadInWorkflowAsMask_viaLoadImageMask = async (channel, workflow) => {
|
|
2519
|
-
const enumName = await this.uploadAndReturnEnumName(workflow.host);
|
|
2520
|
+
const enumName = workflow.dry ? this.enumName : await this.uploadAndReturnEnumName(workflow.host);
|
|
2520
2521
|
return bang(workflow.builderBase.LoadImageMask, "host has no LoadImageMask node")({
|
|
2521
2522
|
image: enumName,
|
|
2522
2523
|
channel
|
|
@@ -2664,6 +2665,18 @@ var MediaImage = class MediaImage {
|
|
|
2664
2665
|
* A claim is released as soon as the write lands (the file itself then holds
|
|
2665
2666
|
* the name) or fails (the name is free again) — the set never accumulates */
|
|
2666
2667
|
const CLAIMED_OUTPUT_PATHS = /* @__PURE__ */ new Set();
|
|
2668
|
+
const AUDIO_MIMES = {
|
|
2669
|
+
flac: "audio/flac",
|
|
2670
|
+
mp3: "audio/mpeg",
|
|
2671
|
+
opus: "audio/ogg",
|
|
2672
|
+
ogg: "audio/ogg",
|
|
2673
|
+
wav: "audio/wav",
|
|
2674
|
+
m4a: "audio/mp4"
|
|
2675
|
+
};
|
|
2676
|
+
function audioMime(filename) {
|
|
2677
|
+
const ext = filename.split(".").pop()?.toLowerCase() ?? "";
|
|
2678
|
+
return AUDIO_MIMES[ext] ?? "application/octet-stream";
|
|
2679
|
+
}
|
|
2667
2680
|
var ComfyExecution = class {
|
|
2668
2681
|
get host() {
|
|
2669
2682
|
return this.workflow.host;
|
|
@@ -2738,8 +2751,51 @@ var ComfyExecution = class {
|
|
|
2738
2751
|
error: e
|
|
2739
2752
|
});
|
|
2740
2753
|
}));
|
|
2754
|
+
for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.retrieveAudio(audio, promptNodeID).catch((e) => {
|
|
2755
|
+
console.error(`🔴 failed to retrieve ${audio.filename}:`, e);
|
|
2756
|
+
this.audioErrors.push({
|
|
2757
|
+
audio,
|
|
2758
|
+
error: e
|
|
2759
|
+
});
|
|
2760
|
+
}));
|
|
2741
2761
|
};
|
|
2742
2762
|
this.pendingPromises = [];
|
|
2763
|
+
this.audioErrors = [];
|
|
2764
|
+
this.audios = [];
|
|
2765
|
+
this.retrieveAudio = async (info, promptNodeID) => {
|
|
2766
|
+
const response = await this.host.fetchFile("/view?" + new URLSearchParams(info).toString());
|
|
2767
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
2768
|
+
const mime = audioMime(info.filename);
|
|
2769
|
+
const sf = this.save;
|
|
2770
|
+
if (sf == null) {
|
|
2771
|
+
this.audios.push({
|
|
2772
|
+
nodeId: promptNodeID,
|
|
2773
|
+
filename: info.filename,
|
|
2774
|
+
mime,
|
|
2775
|
+
bytes,
|
|
2776
|
+
absPath: null
|
|
2777
|
+
});
|
|
2778
|
+
return;
|
|
2779
|
+
}
|
|
2780
|
+
const promptPrefix = this.workflow.data.apiJson?.[promptNodeID]?.inputs["filename_prefix"];
|
|
2781
|
+
const written = await this.encodeAndWrite({
|
|
2782
|
+
bytes,
|
|
2783
|
+
sf: {
|
|
2784
|
+
...sf,
|
|
2785
|
+
format: "raw"
|
|
2786
|
+
},
|
|
2787
|
+
filenamePrefix: typeof promptPrefix === "string" ? promptPrefix : void 0,
|
|
2788
|
+
subfolder: info.subfolder,
|
|
2789
|
+
filename: info.filename
|
|
2790
|
+
});
|
|
2791
|
+
this.audios.push({
|
|
2792
|
+
nodeId: promptNodeID,
|
|
2793
|
+
filename: info.filename,
|
|
2794
|
+
mime,
|
|
2795
|
+
bytes,
|
|
2796
|
+
absPath: written.path
|
|
2797
|
+
});
|
|
2798
|
+
};
|
|
2743
2799
|
this.imageErrors = [];
|
|
2744
2800
|
this.retrieveImage = async (comfyImageInfo, promptNodeID) => {
|
|
2745
2801
|
const promptNode = this.workflow.data.apiJson?.[promptNodeID];
|
|
@@ -2911,6 +2967,7 @@ var ComfyExecution = class {
|
|
|
2911
2967
|
if (!this.logProgress) return;
|
|
2912
2968
|
const p = this.progress;
|
|
2913
2969
|
const outputs = [`${this.images.length} image(s)`];
|
|
2970
|
+
if (this.audios.length > 0) outputs.push(`${this.audios.length} audio(s)`);
|
|
2914
2971
|
if (this.texts.length > 0) outputs.push(`${this.texts.length} text(s)`);
|
|
2915
2972
|
const line = `${this.status === "Failure" ? "🔴" : "🟢"} ${this.status.toLowerCase()} in ${(p.elapsedMs / 1e3).toFixed(1)}s · ${outputs.join(" · ")}`;
|
|
2916
2973
|
if (globalThis.process?.stdout?.isTTY) process.stdout.write(`\r\x1b[2K${line}\n`);
|
|
@@ -3110,6 +3167,7 @@ var ComfyWorkflow = class {
|
|
|
3110
3167
|
constructor(host, data) {
|
|
3111
3168
|
this.host = host;
|
|
3112
3169
|
this.data = data;
|
|
3170
|
+
this.dry = false;
|
|
3113
3171
|
this.nodes = [];
|
|
3114
3172
|
this.registerNode = (node) => {
|
|
3115
3173
|
if (this.data.apiJson == null) throw new Error("graph not hydrated");
|
|
@@ -3336,16 +3394,16 @@ const types = scope({
|
|
|
3336
3394
|
"hidden?": "string[]"
|
|
3337
3395
|
},
|
|
3338
3396
|
output: "ComfyInputType[]",
|
|
3339
|
-
output_is_list: "boolean[]",
|
|
3397
|
+
output_is_list: "(boolean | null)[]",
|
|
3340
3398
|
output_name: "string[]",
|
|
3341
3399
|
name: "string",
|
|
3342
|
-
display_name: "string",
|
|
3400
|
+
display_name: "string | null",
|
|
3343
3401
|
description: "string",
|
|
3344
3402
|
/** */
|
|
3345
3403
|
python_module: "string",
|
|
3346
3404
|
category: "string",
|
|
3347
3405
|
output_node: "boolean",
|
|
3348
|
-
"output_tooltips?": "string[]",
|
|
3406
|
+
"output_tooltips?": "(string | null)[]",
|
|
3349
3407
|
"deprecated?": "boolean",
|
|
3350
3408
|
"experimental?": "boolean"
|
|
3351
3409
|
},
|
|
@@ -3361,7 +3419,7 @@ const types = scope({
|
|
|
3361
3419
|
ComfyInputOpts_advanced: {
|
|
3362
3420
|
"tooltip?": "string | null | ComfyInputOpts_advanced",
|
|
3363
3421
|
"multiline?": "boolean | null",
|
|
3364
|
-
"default?": "boolean | number | string | null | number[]",
|
|
3422
|
+
"default?": "boolean | number | string | null | number[] | object",
|
|
3365
3423
|
"forceInput?": "boolean | null",
|
|
3366
3424
|
"min?": "number | null",
|
|
3367
3425
|
"round?": "boolean | number | null",
|
|
@@ -3722,14 +3780,46 @@ var ResilientWebSocketClient = class {
|
|
|
3722
3780
|
this.isOpen = false;
|
|
3723
3781
|
this.debugMessages = [];
|
|
3724
3782
|
this.hasEverOpened = false;
|
|
3783
|
+
this.heartbeat = null;
|
|
3725
3784
|
this.permanentlyClosed = false;
|
|
3726
3785
|
this.url = options.url();
|
|
3727
3786
|
this.connect();
|
|
3728
3787
|
}
|
|
3788
|
+
stopHeartbeat() {
|
|
3789
|
+
if (this.heartbeat != null) clearInterval(this.heartbeat);
|
|
3790
|
+
this.heartbeat = null;
|
|
3791
|
+
}
|
|
3792
|
+
/** ping on a timer; no pong since the previous ping = the peer is gone, drop the socket */
|
|
3793
|
+
startHeartbeat(ws) {
|
|
3794
|
+
this.stopHeartbeat();
|
|
3795
|
+
if (typeof ws.ping !== "function" || typeof ws.on !== "function") return;
|
|
3796
|
+
let awaitingPong = false;
|
|
3797
|
+
ws.on("pong", () => {
|
|
3798
|
+
awaitingPong = false;
|
|
3799
|
+
});
|
|
3800
|
+
const ms = this.options.heartbeatMs ?? 15e3;
|
|
3801
|
+
this.heartbeat = setInterval(() => {
|
|
3802
|
+
if (ws !== this.currentWS) return this.stopHeartbeat();
|
|
3803
|
+
if (awaitingPong) {
|
|
3804
|
+
this.addError(`no pong within ${ms}ms: the host is gone, dropping the socket to reconnect`);
|
|
3805
|
+
this.stopHeartbeat();
|
|
3806
|
+
if (typeof ws.terminate === "function") ws.terminate();
|
|
3807
|
+
else ws.close();
|
|
3808
|
+
return;
|
|
3809
|
+
}
|
|
3810
|
+
awaitingPong = true;
|
|
3811
|
+
try {
|
|
3812
|
+
ws.ping?.();
|
|
3813
|
+
} catch (e) {
|
|
3814
|
+
this.addError(`ping failed: ${extractErrorMessage(e)}`);
|
|
3815
|
+
}
|
|
3816
|
+
}, ms);
|
|
3817
|
+
}
|
|
3729
3818
|
/** close and stop reconnecting (lets a script exit cleanly) */
|
|
3730
3819
|
disconnectPermanently() {
|
|
3731
3820
|
this.permanentlyClosed = true;
|
|
3732
3821
|
if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
|
|
3822
|
+
this.stopHeartbeat();
|
|
3733
3823
|
this.currentWS?.close();
|
|
3734
3824
|
this.currentWS = null;
|
|
3735
3825
|
this.isOpen = false;
|
|
@@ -3748,6 +3838,7 @@ var ResilientWebSocketClient = class {
|
|
|
3748
3838
|
this.isOpen = false;
|
|
3749
3839
|
const prevWS = this.currentWS;
|
|
3750
3840
|
if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
|
|
3841
|
+
this.stopHeartbeat();
|
|
3751
3842
|
this.currentWS = null;
|
|
3752
3843
|
if (prevWS) {
|
|
3753
3844
|
this.addInfo("Previous WebSocket discarded");
|
|
@@ -3755,7 +3846,7 @@ var ResilientWebSocketClient = class {
|
|
|
3755
3846
|
}
|
|
3756
3847
|
let ws;
|
|
3757
3848
|
try {
|
|
3758
|
-
const transport = await resolveWsTransport();
|
|
3849
|
+
const transport = this.options.transport ?? await resolveWsTransport();
|
|
3759
3850
|
if (this.permanentlyClosed) return;
|
|
3760
3851
|
const headers = this.options.headers?.() ?? {};
|
|
3761
3852
|
ws = transport.supportsHeaders ? new transport.ctor(this.url, { headers }) : new transport.ctor(this.headerlessUrl(headers));
|
|
@@ -3777,10 +3868,12 @@ var ResilientWebSocketClient = class {
|
|
|
3777
3868
|
this.isOpen = true;
|
|
3778
3869
|
this.options.onConnectOrReconnect();
|
|
3779
3870
|
this.flushMessageBuffer();
|
|
3871
|
+
this.startHeartbeat(ws);
|
|
3780
3872
|
};
|
|
3781
3873
|
ws.onclose = (event) => {
|
|
3782
3874
|
if (ws !== this.currentWS) return;
|
|
3783
3875
|
this.isOpen = false;
|
|
3876
|
+
this.stopHeartbeat();
|
|
3784
3877
|
this.options.onClose();
|
|
3785
3878
|
if (this.permanentlyClosed) return;
|
|
3786
3879
|
this.addError(`WebSocket closed (reason=${JSON.stringify(event.reason)}, code=${event.code})`);
|
|
@@ -3789,8 +3882,9 @@ var ResilientWebSocketClient = class {
|
|
|
3789
3882
|
this.options.onFirstConnectFailed(/* @__PURE__ */ new Error(`connection refused (code=${event.code}${event.reason === "" ? "" : `, ${event.reason}`})`));
|
|
3790
3883
|
return;
|
|
3791
3884
|
}
|
|
3792
|
-
this.
|
|
3793
|
-
this.
|
|
3885
|
+
const wait = this.options.reconnectMs ?? 2e3;
|
|
3886
|
+
this.addInfo(`⏱️ reconnecting in ${wait / 1e3} seconds...`);
|
|
3887
|
+
this.reconnectTimeout = setTimeout(() => void this.connect(), wait);
|
|
3794
3888
|
};
|
|
3795
3889
|
ws.onerror = (event) => {
|
|
3796
3890
|
if (ws !== this.currentWS) return;
|
|
@@ -4004,8 +4098,22 @@ var ComfyHost = class {
|
|
|
4004
4098
|
this.clearQueue = () => {
|
|
4005
4099
|
return this.postJSON_("/queue", { clear: true });
|
|
4006
4100
|
};
|
|
4101
|
+
this.interruptCoalesceMs = 3e3;
|
|
4102
|
+
this._lastInterrupt = null;
|
|
4007
4103
|
this.interrupt = () => {
|
|
4008
|
-
|
|
4104
|
+
const now = Date.now();
|
|
4105
|
+
const last = this._lastInterrupt;
|
|
4106
|
+
if (last != null && last.promptID === this.activePromptID && now - last.at < this.interruptCoalesceMs) return last.req;
|
|
4107
|
+
const req = this.postJSON_("/interrupt", {});
|
|
4108
|
+
this._lastInterrupt = {
|
|
4109
|
+
promptID: this.activePromptID,
|
|
4110
|
+
at: now,
|
|
4111
|
+
req
|
|
4112
|
+
};
|
|
4113
|
+
req.catch(() => {
|
|
4114
|
+
if (this._lastInterrupt?.req === req) this._lastInterrupt = null;
|
|
4115
|
+
});
|
|
4116
|
+
return req;
|
|
4009
4117
|
};
|
|
4010
4118
|
this.deleteHistory = (promptId) => {
|
|
4011
4119
|
return this.postJSON_("/history", { delete: [promptId] });
|
|
@@ -4990,6 +5098,10 @@ var ComfyTS = class ComfyTS {
|
|
|
4990
5098
|
resolveFromPromptEnhancers(relativePath) {
|
|
4991
5099
|
return asAbsolutePath(join(this.baseFolder, "prompt-enhancers", relativePath));
|
|
4992
5100
|
}
|
|
5101
|
+
/** the serve web ui's LLM configs (prompt enhancer), one json per config */
|
|
5102
|
+
resolveFromLlmConfigs(relativePath) {
|
|
5103
|
+
return asAbsolutePath(join(this.baseFolder, "llm-configs", relativePath));
|
|
5104
|
+
}
|
|
4993
5105
|
resolveFromCache(relativePath) {
|
|
4994
5106
|
return asAbsolutePath(join(this.baseFolder, "cache", relativePath));
|
|
4995
5107
|
}
|
|
@@ -5016,4 +5128,4 @@ var ComfyTS = class ComfyTS {
|
|
|
5016
5128
|
//#endregion
|
|
5017
5129
|
export { ComfySchema as a, importSharp as i, settingsPathFor as n, readableStringify as r, ComfyTS as t };
|
|
5018
5130
|
|
|
5019
|
-
//# sourceMappingURL=state
|
|
5131
|
+
//# sourceMappingURL=state-CUp2J1Zy.js.map
|