comfy-ts 2.2.0 → 2.4.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 +13 -0
- package/dist/{DefinedWorkflow-CwHInZgn.js → DefinedWorkflow-QrhT6V66.js} +441 -9
- package/dist/DefinedWorkflow-QrhT6V66.js.map +1 -0
- package/dist/{DraftsSt-omWuBSej.js → DraftsSt-D9Fhk4qR.js} +2 -2
- package/dist/{DraftsSt-omWuBSej.js.map → DraftsSt-D9Fhk4qR.js.map} +1 -1
- package/dist/cli.js +116 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +292 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -9
- package/dist/index.d.ts +147 -9
- package/dist/index.js +280 -25
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-C1oo5ilG.js → run-serve-C9E8dyLP.js} +7 -3
- package/dist/run-serve-C9E8dyLP.js.map +1 -0
- package/dist/{run-tui-CuVst-nc.js → run-tui-cawSJuuh.js} +60 -121
- package/dist/run-tui-cawSJuuh.js.map +1 -0
- package/dist/{state-CvMt0W1-.js → state-BbKuSDCV.js} +38 -77
- package/dist/state-BbKuSDCV.js.map +1 -0
- package/dist/web.d.ts +147 -9
- package/dist/web.js +280 -25
- package/dist/web.js.map +1 -1
- package/guide-for-agents.md +3 -0
- package/package.json +2 -1
- package/src/cli/comfy-ts-cli.ts +16 -1
- package/src/cli/flags.ts +14 -0
- package/src/cli/gen.ts +2 -4
- package/src/cli/loras.ts +113 -0
- package/src/cli/serve/ServeApp.ts +4 -0
- package/src/cli/serve/applyVarPayload.ts +1 -1
- package/src/cli/tui/components/LorasOverlay.tsx +18 -5
- package/src/cli/tui/components/StatusBar.tsx +1 -0
- package/src/cli/tui/components/TuiApp.tsx +1 -0
- package/src/cli/tui/imageClipboard.ts +3 -3
- package/src/cli/tui/protocolImagePainter.ts +1 -1
- package/src/cli/tui/run-tui.tsx +2 -2
- package/src/cli/tui/state/ExecSt.ts +2 -2
- package/src/cli/tui/state/HostSt.ts +1 -1
- package/src/cli/tui/state/LorasSt.ts +60 -15
- package/src/cli/tui/state/PreviewSt.ts +1 -1
- package/src/cli/tui/state/SettingsSt.ts +1 -1
- package/src/coreExports.ts +21 -1
- package/src/host/ComfyHost.ts +51 -3
- package/src/host/loraInfoCache.ts +216 -0
- package/src/host/loraManagerApi.ts +131 -27
- package/src/runner/ComfyExecution.ts +1 -1
- package/src/runner/outputPath.ts +3 -3
- package/src/utils/isRecord.ts +4 -0
- package/src/vars/ComfyVars.ts +13 -7
- package/src/vars/loraKeywords.ts +48 -5
- package/dist/DefinedWorkflow-CwHInZgn.js.map +0 -1
- package/dist/run-serve-C1oo5ilG.js.map +0 -1
- package/dist/run-tui-CuVst-nc.js.map +0 -1
- package/dist/state-CvMt0W1-.js.map +0 -1
|
@@ -1,77 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as sha1HexOfString, C as getComfyStorage, D as logInfo, E as logError, O as logSuccess, S as extractErrorMessage, T as isQuiet, k as sha1Hex, t as DefinedWorkflow, w as resolveComfyStorage } from "./DefinedWorkflow-QrhT6V66.js";
|
|
2
2
|
import { basename, join } from "pathe";
|
|
3
3
|
import { scope, type } from "arktype";
|
|
4
4
|
import { nanoid } from "nanoid";
|
|
5
5
|
import { imageMeta } from "image-meta";
|
|
6
|
-
//#region src/utils/sha1.ts
|
|
7
|
-
function sha1Hex(data) {
|
|
8
|
-
const ml = data.length;
|
|
9
|
-
const total = Math.ceil((ml + 1 + 8) / 64) * 64;
|
|
10
|
-
const bytes = new Uint8Array(total);
|
|
11
|
-
bytes.set(data);
|
|
12
|
-
bytes[ml] = 128;
|
|
13
|
-
const dv = new DataView(bytes.buffer);
|
|
14
|
-
const bitLen = ml * 8;
|
|
15
|
-
dv.setUint32(total - 8, Math.floor(bitLen / 2 ** 32));
|
|
16
|
-
dv.setUint32(total - 4, bitLen >>> 0);
|
|
17
|
-
let h0 = 1732584193;
|
|
18
|
-
let h1 = 4023233417;
|
|
19
|
-
let h2 = 2562383102;
|
|
20
|
-
let h3 = 271733878;
|
|
21
|
-
let h4 = 3285377520;
|
|
22
|
-
const w = /* @__PURE__ */ new Uint32Array(80);
|
|
23
|
-
for (let i = 0; i < total; i += 64) {
|
|
24
|
-
for (let j = 0; j < 16; j++) w[j] = dv.getUint32(i + j * 4);
|
|
25
|
-
for (let j = 16; j < 80; j++) {
|
|
26
|
-
const n = (w[j - 3] ?? 0) ^ (w[j - 8] ?? 0) ^ (w[j - 14] ?? 0) ^ (w[j - 16] ?? 0);
|
|
27
|
-
w[j] = n << 1 | n >>> 31;
|
|
28
|
-
}
|
|
29
|
-
let a = h0;
|
|
30
|
-
let b = h1;
|
|
31
|
-
let c = h2;
|
|
32
|
-
let d = h3;
|
|
33
|
-
let e = h4;
|
|
34
|
-
for (let j = 0; j < 80; j++) {
|
|
35
|
-
let f;
|
|
36
|
-
let k;
|
|
37
|
-
if (j < 20) {
|
|
38
|
-
f = b & c | ~b & d;
|
|
39
|
-
k = 1518500249;
|
|
40
|
-
} else if (j < 40) {
|
|
41
|
-
f = b ^ c ^ d;
|
|
42
|
-
k = 1859775393;
|
|
43
|
-
} else if (j < 60) {
|
|
44
|
-
f = b & c | b & d | c & d;
|
|
45
|
-
k = 2400959708;
|
|
46
|
-
} else {
|
|
47
|
-
f = b ^ c ^ d;
|
|
48
|
-
k = 3395469782;
|
|
49
|
-
}
|
|
50
|
-
const temp = (a << 5 | a >>> 27) + f + e + k + (w[j] ?? 0) >>> 0;
|
|
51
|
-
e = d;
|
|
52
|
-
d = c;
|
|
53
|
-
c = b << 30 | b >>> 2;
|
|
54
|
-
b = a;
|
|
55
|
-
a = temp;
|
|
56
|
-
}
|
|
57
|
-
h0 = h0 + a >>> 0;
|
|
58
|
-
h1 = h1 + b >>> 0;
|
|
59
|
-
h2 = h2 + c >>> 0;
|
|
60
|
-
h3 = h3 + d >>> 0;
|
|
61
|
-
h4 = h4 + e >>> 0;
|
|
62
|
-
}
|
|
63
|
-
return [
|
|
64
|
-
h0,
|
|
65
|
-
h1,
|
|
66
|
-
h2,
|
|
67
|
-
h3,
|
|
68
|
-
h4
|
|
69
|
-
].map((x) => x.toString(16).padStart(8, "0")).join("");
|
|
70
|
-
}
|
|
71
|
-
function sha1HexOfString(s) {
|
|
72
|
-
return sha1Hex(new TextEncoder().encode(s));
|
|
73
|
-
}
|
|
74
|
-
//#endregion
|
|
75
6
|
//#region src/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.ts
|
|
76
7
|
/** having a bunch of sensible default will help slightly */
|
|
77
8
|
function getUnionNameBasedOnFirstFoundEnumName(enumName, hash, hashContent) {
|
|
@@ -884,7 +815,7 @@ var ComfySchema = class {
|
|
|
884
815
|
};
|
|
885
816
|
//#endregion
|
|
886
817
|
//#region package.json
|
|
887
|
-
var version = "2.
|
|
818
|
+
var version = "2.4.0";
|
|
888
819
|
//#endregion
|
|
889
820
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
890
821
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -2198,8 +2129,8 @@ var LiteGraphCtx = class {
|
|
|
2198
2129
|
//#endregion
|
|
2199
2130
|
//#region src/runner/outputPath.ts
|
|
2200
2131
|
/**
|
|
2201
|
-
* local output naming, relative to `.comfy-ts/outputs
|
|
2202
|
-
*
|
|
2132
|
+
* local output naming, relative to `.comfy-ts/outputs/`:
|
|
2133
|
+
* the server filename is NOT unique — cloud hosts reset the
|
|
2203
2134
|
* `_00001_` counter every run, so trusting it overwrote the same file — and
|
|
2204
2135
|
* a `foo/krea/` prefix means the DIRECTORY foo/krea/, not a `krea_` name
|
|
2205
2136
|
* prefix. Local names are ours: dir from the prompt's own filename_prefix
|
|
@@ -2244,7 +2175,7 @@ const withExtension = (path, ext) => {
|
|
|
2244
2175
|
/**
|
|
2245
2176
|
* never-overwrite guard: bump `-2`, `-3`, … while the path exists on disk OR
|
|
2246
2177
|
* was already CLAIMED by a still-downloading retrieval (two same-second runs
|
|
2247
|
-
* on a counter-resetting cloud host compute the same name
|
|
2178
|
+
* on a counter-resetting cloud host compute the same name).
|
|
2248
2179
|
* The chosen path is claimed before returning.
|
|
2249
2180
|
*/
|
|
2250
2181
|
const uniquifyOutputPath = (p) => {
|
|
@@ -3753,6 +3684,14 @@ var ResilientWebSocketClient = class {
|
|
|
3753
3684
|
};
|
|
3754
3685
|
//#endregion
|
|
3755
3686
|
//#region src/host/ComfyHost.ts
|
|
3687
|
+
/** the host never came up within ConnectOptions.timeoutMs */
|
|
3688
|
+
var ComfyHostUnreachableError = class extends Error {
|
|
3689
|
+
constructor(..._args) {
|
|
3690
|
+
super(..._args);
|
|
3691
|
+
this.name = "ComfyHostUnreachableError";
|
|
3692
|
+
}
|
|
3693
|
+
};
|
|
3694
|
+
const DEFAULT_CONNECT_TIMEOUT_MS = 3e4;
|
|
3756
3695
|
/** auth failure with a SPECIFIC meaning (per the Comfy Cloud error table):
|
|
3757
3696
|
* 401 invalid/missing key · 402 insufficient credits · 429 subscription inactive
|
|
3758
3697
|
* (or plain rate limiting on non-cloud hosts). The key value never appears here. */
|
|
@@ -3902,14 +3841,25 @@ var ComfyHost = class {
|
|
|
3902
3841
|
this._readyResolve = res;
|
|
3903
3842
|
this._readyReject = rej;
|
|
3904
3843
|
});
|
|
3844
|
+
const timeoutMs = p.timeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
|
|
3845
|
+
if (timeoutMs > 0 && Number.isFinite(timeoutMs)) {
|
|
3846
|
+
this._connectTimer = setTimeout(() => {
|
|
3847
|
+
this.markFailed(new ComfyHostUnreachableError(`host '${this.data.id}' did not come up within ${timeoutMs}ms at ${this.getWSUrl()} — is ComfyUI running there ?`));
|
|
3848
|
+
}, timeoutMs);
|
|
3849
|
+
this._connectTimer.unref?.();
|
|
3850
|
+
}
|
|
3905
3851
|
this.initWebsocket();
|
|
3906
3852
|
}
|
|
3907
3853
|
return this._ready;
|
|
3908
3854
|
};
|
|
3855
|
+
this._connectTimer = null;
|
|
3909
3856
|
this.disconnect = () => {
|
|
3857
|
+
this.clearConnectTimer();
|
|
3910
3858
|
this.ws?.disconnectPermanently();
|
|
3911
3859
|
this.ws = null;
|
|
3912
3860
|
this._ready = null;
|
|
3861
|
+
this._readyResolve = null;
|
|
3862
|
+
this._readyReject = null;
|
|
3913
3863
|
};
|
|
3914
3864
|
this.ws = null;
|
|
3915
3865
|
this._sessionResolve = null;
|
|
@@ -4054,15 +4004,26 @@ var ComfyHost = class {
|
|
|
4054
4004
|
get isConnected() {
|
|
4055
4005
|
return this.ws?.isOpen ?? false;
|
|
4056
4006
|
}
|
|
4007
|
+
clearConnectTimer() {
|
|
4008
|
+
if (this._connectTimer != null) clearTimeout(this._connectTimer);
|
|
4009
|
+
this._connectTimer = null;
|
|
4010
|
+
}
|
|
4057
4011
|
markReady() {
|
|
4012
|
+
this.clearConnectTimer();
|
|
4058
4013
|
this._readyResolve?.();
|
|
4059
4014
|
this._readyResolve = null;
|
|
4060
4015
|
this._readyReject = null;
|
|
4061
4016
|
}
|
|
4062
4017
|
markFailed(error) {
|
|
4063
|
-
this.
|
|
4018
|
+
this.clearConnectTimer();
|
|
4019
|
+
const reject = this._readyReject;
|
|
4020
|
+
if (reject == null) return;
|
|
4064
4021
|
this._readyResolve = null;
|
|
4065
4022
|
this._readyReject = null;
|
|
4023
|
+
this._ready = null;
|
|
4024
|
+
this.ws?.disconnectPermanently();
|
|
4025
|
+
this.ws = null;
|
|
4026
|
+
reject(error);
|
|
4066
4027
|
}
|
|
4067
4028
|
async writeSDKToDisk() {
|
|
4068
4029
|
if (this.data.sdkAutoWrite === false) return;
|
|
@@ -4898,6 +4859,6 @@ var ComfyTS = class ComfyTS {
|
|
|
4898
4859
|
}
|
|
4899
4860
|
};
|
|
4900
4861
|
//#endregion
|
|
4901
|
-
export { importSharp as a, stripAnsi as i, settingsPathFor as n, ComfySchema as o, readableStringify as r,
|
|
4862
|
+
export { importSharp as a, stripAnsi as i, settingsPathFor as n, ComfySchema as o, readableStringify as r, ComfyTS as t };
|
|
4902
4863
|
|
|
4903
|
-
//# sourceMappingURL=state-
|
|
4864
|
+
//# sourceMappingURL=state-BbKuSDCV.js.map
|