comfy-ts 2.20.2 → 2.22.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 +17 -1
- package/dist/{ServeApp-B469W26E.js → ServeApp-DuxYdaZZ.js} +142 -7
- package/dist/ServeApp-DuxYdaZZ.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{exampleAssets-yBLaKXLq.js → exampleAssets-1NHndnNB.js} +59 -17
- package/dist/exampleAssets-1NHndnNB.js.map +1 -0
- package/dist/{findDefinedWorkflow-B90-xFxX.js → findDefinedWorkflow-CRsBTTJK.js} +2 -2
- package/dist/{findDefinedWorkflow-B90-xFxX.js.map → findDefinedWorkflow-CRsBTTJK.js.map} +1 -1
- package/dist/index.cjs +118 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -9
- package/dist/index.d.ts +90 -9
- package/dist/index.js +117 -20
- package/dist/index.js.map +1 -1
- package/dist/{run-run-C-dDD9Dc.js → run-run-Y5ZI48vV.js} +5 -5
- package/dist/{run-run-C-dDD9Dc.js.map → run-run-Y5ZI48vV.js.map} +1 -1
- package/dist/{run-serve-CsEYPGm9.js → run-serve-CICU_wTL.js} +4 -4
- package/dist/{run-serve-CsEYPGm9.js.map → run-serve-CICU_wTL.js.map} +1 -1
- package/dist/{run-tui-bsmja4hi.js → run-tui-CViJXsHL.js} +4 -4
- package/dist/{run-tui-bsmja4hi.js.map → run-tui-CViJXsHL.js.map} +1 -1
- package/dist/{schemaDrift-DaWsE-mt.js → schemaDrift-CzjaIwZX.js} +53 -20
- package/dist/schemaDrift-CzjaIwZX.js.map +1 -0
- package/dist/serve-web.js +204 -47
- package/dist/web.d.ts +90 -9
- package/dist/web.js +117 -20
- package/dist/web.js.map +1 -1
- package/examples/README.md +2 -0
- package/examples/depth-explorer/models.ts +722 -0
- package/examples/depth-explorer/serve.ts +140 -0
- package/examples/depth-explorer/thumbs/bae.webp +0 -0
- package/examples/depth-explorer/thumbs/da3-mono-large.webp +0 -0
- package/examples/depth-explorer/thumbs/dav1-vitl.webp +0 -0
- package/examples/depth-explorer/thumbs/dav2-vitl.webp +0 -0
- package/examples/depth-explorer/thumbs/dsine.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-albedo.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-metalness.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-roughness.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-shading.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-specular.webp +0 -0
- package/examples/depth-explorer/thumbs/leres.webp +0 -0
- package/examples/depth-explorer/thumbs/lotus-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/marigold2-albedo.webp +0 -0
- package/examples/depth-explorer/thumbs/marigold2-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/marigold2-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/metric3d-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/metric3d-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/midas-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/midas.webp +0 -0
- package/examples/depth-explorer/thumbs/moge2-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/moge2-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/zoe-da.webp +0 -0
- package/examples/depth-explorer/thumbs/zoe.webp +0 -0
- package/examples/depth-explorer/web/App.tsx +457 -0
- package/examples/depth-explorer/web/gl.ts +202 -0
- package/examples/depth-explorer/web/index.html +14 -0
- package/examples/depth-explorer/web/main.tsx +19 -0
- package/examples/depth-explorer/web/pixels.ts +86 -0
- package/examples/depth-explorer/web/state.ts +329 -0
- package/examples/depth-explorer/web/styles.css +366 -0
- package/examples/depth-explorer/web/tsconfig.json +16 -0
- package/examples/rvion/17-relight.cflow.ts +110 -0
- package/package.json +3 -2
- package/src/cli/serve/ServeApp.ts +79 -4
- package/src/cli/serve/describeVar.ts +12 -1
- package/src/cli/serve/resultHistory.ts +6 -1
- package/src/cli/serve/thumbs.ts +66 -0
- package/src/cli/serve/web/api.ts +5 -1
- package/src/cli/serve/web/components/Gallery.tsx +2 -0
- package/src/cli/serve/web/components/controls/BasicControls.tsx +14 -17
- package/src/cli/serve/web/components/controls/MediaControl.tsx +62 -9
- package/src/cli/serve/web/components/controls/RichSelect.tsx +262 -0
- package/src/cli/serve/web/state/RunSt.poll.test.ts +4 -1
- package/src/cli/serve/web/state/choiceButtons.ts +26 -2
- package/src/cli/serve/web/styles.ts +39 -0
- package/src/cli/serve/web/widgets/OutputWidgets.tsx +19 -0
- package/src/cli/serve/web/widgets/RelightSt.ts +113 -0
- package/src/cli/serve/web/widgets/RelightWidget.tsx +305 -0
- package/src/cli/serve/web/widgets/relightGl.ts +305 -0
- package/src/cli/serve/web/widgets/widgetStyles.ts +19 -0
- package/src/coreExports.ts +9 -0
- package/src/host/ComfyHost.ts +21 -0
- package/src/host/leastBusy.ts +37 -0
- package/src/state.ts +6 -0
- package/src/vars/ComfyVars.ts +32 -2
- package/src/vars/DefinedWorkflow.ts +42 -21
- package/src/vars/outputWidgets.ts +47 -0
- package/dist/ServeApp-B469W26E.js.map +0 -1
- package/dist/exampleAssets-yBLaKXLq.js.map +0 -1
- package/dist/schemaDrift-DaWsE-mt.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as readableStringify, c as
|
|
3
|
-
import { D as readLoraMirror, F as fetchLoraList, H as lmModelName, K as lmTrainedWords, _ as buildLoraMirror, j as writeLoraMirror } from "./schemaDrift-
|
|
2
|
+
import { a as readableStringify, c as renderHttpBase, n as comfyTsPackageDir, o as ComfySchema, r as ComfyTS, s as writeHostFile } from "./exampleAssets-1NHndnNB.js";
|
|
3
|
+
import { D as readLoraMirror, F as fetchLoraList, H as lmModelName, K as lmTrainedWords, _ as buildLoraMirror, j as writeLoraMirror } from "./schemaDrift-CzjaIwZX.js";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import { constants, homedir } from "node:os";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -554,14 +554,14 @@ async function main() {
|
|
|
554
554
|
}
|
|
555
555
|
armHopChild();
|
|
556
556
|
if (cmd === "run") {
|
|
557
|
-
const { runRun } = await import("./run-run-
|
|
557
|
+
const { runRun } = await import("./run-run-Y5ZI48vV.js");
|
|
558
558
|
return runRun(rest);
|
|
559
559
|
}
|
|
560
560
|
if (cmd === "serve") {
|
|
561
|
-
const { runServe } = await import("./run-serve-
|
|
561
|
+
const { runServe } = await import("./run-serve-CICU_wTL.js");
|
|
562
562
|
return runServe(rest);
|
|
563
563
|
}
|
|
564
|
-
const { runTui } = await import("./run-tui-
|
|
564
|
+
const { runTui } = await import("./run-tui-CViJXsHL.js");
|
|
565
565
|
return runTui(rest);
|
|
566
566
|
}
|
|
567
567
|
console.log(HELP);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { X as ansi, a as DefinedWorkflow, at as
|
|
1
|
+
import { X as ansi, a as DefinedWorkflow, at as importSharp, ct as getComfyStorage, dt as logError, ft as logInfo, gt as extractErrorMessage, ht as sha1HexOfString, it as hashArrayBuffer, lt as resolveComfyStorage, mt as statelessRegex, n as diffSchemas, nt as isVideoFilename, ot as isRecord$1, pt as logSuccess, rt as mediaMime, st as bang, t as MODEL_LISTS, ut as isQuiet } from "./schemaDrift-CzjaIwZX.js";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, join } from "pathe";
|
|
@@ -1003,7 +1003,7 @@ var ComfySchema = class {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
//#endregion
|
|
1005
1005
|
//#region package.json
|
|
1006
|
-
var version = "2.
|
|
1006
|
+
var version = "2.22.0";
|
|
1007
1007
|
//#endregion
|
|
1008
1008
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
1009
1009
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -2798,19 +2798,6 @@ const runTimestamp = (d) => {
|
|
|
2798
2798
|
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
|
|
2799
2799
|
};
|
|
2800
2800
|
//#endregion
|
|
2801
|
-
//#region src/utils/lazySharp.ts
|
|
2802
|
-
let cached = null;
|
|
2803
|
-
async function importSharp(reason) {
|
|
2804
|
-
if (cached != null) return cached;
|
|
2805
|
-
const specifier = "sharp";
|
|
2806
|
-
try {
|
|
2807
|
-
cached = (await import(specifier)).default;
|
|
2808
|
-
return cached;
|
|
2809
|
-
} catch (e) {
|
|
2810
|
-
throw new Error(`sharp is unavailable — ${reason} is node-only (browser builds get raw bytes instead): ${extractErrorMessage(e)}`, { cause: e });
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
//#endregion
|
|
2814
2801
|
//#region src/types/index.ts
|
|
2815
2802
|
const asAbsolutePath = (path) => path;
|
|
2816
2803
|
const resultSuccess = (value) => ({
|
|
@@ -5168,6 +5155,14 @@ var ComfyHost = class {
|
|
|
5168
5155
|
if (!res.ok) throw new Error(`GET /system_stats failed: ${res.status}`);
|
|
5169
5156
|
return previewMethodFromSystemStats(await res.json());
|
|
5170
5157
|
};
|
|
5158
|
+
this.fetchQueueSize = async (p = {}) => {
|
|
5159
|
+
const res = await this.fetch("/prompt", { signal: AbortSignal.timeout(p.timeoutMs ?? 3e3) });
|
|
5160
|
+
if (!res.ok) throw new Error(`GET /prompt failed: ${res.status}`);
|
|
5161
|
+
const size = queueRemainingOf(await res.json());
|
|
5162
|
+
if (size == null) throw new Error(`GET /prompt: no exec_info.queue_remaining in the reply`);
|
|
5163
|
+
return size;
|
|
5164
|
+
};
|
|
5165
|
+
this.runsInFlight = 0;
|
|
5171
5166
|
this.fetchRawLogs = async () => {
|
|
5172
5167
|
const res = await this.fetch("/internal/logs/raw", {}, { apiPrefix: false });
|
|
5173
5168
|
if (!res.ok) throw new Error(`GET /internal/logs/raw failed: ${res.status}`);
|
|
@@ -5566,6 +5561,49 @@ var ComfyHost = class {
|
|
|
5566
5561
|
}
|
|
5567
5562
|
}
|
|
5568
5563
|
};
|
|
5564
|
+
/** `exec_info.queue_remaining` of a `GET /prompt` reply, null when the shape is not there */
|
|
5565
|
+
function queueRemainingOf(json) {
|
|
5566
|
+
if (typeof json !== "object" || json == null || !("exec_info" in json)) return null;
|
|
5567
|
+
const info = json.exec_info;
|
|
5568
|
+
if (typeof info !== "object" || info == null || !("queue_remaining" in info)) return null;
|
|
5569
|
+
return typeof info.queue_remaining === "number" ? info.queue_remaining : null;
|
|
5570
|
+
}
|
|
5571
|
+
//#endregion
|
|
5572
|
+
//#region src/host/leastBusy.ts
|
|
5573
|
+
/**
|
|
5574
|
+
* the host with the shortest queue. Score = max(server queue, our runs in flight there):
|
|
5575
|
+
* the server counts every client, the local count sees runs not posted yet.
|
|
5576
|
+
* Ties go to the first host listed; a host that does not answer is skipped, all down throws.
|
|
5577
|
+
*/
|
|
5578
|
+
async function leastBusy(hosts, p = {}) {
|
|
5579
|
+
if (hosts.length === 0) throw new Error("leastBusy: no host given");
|
|
5580
|
+
const probes = await Promise.all(hosts.map(async (host) => {
|
|
5581
|
+
try {
|
|
5582
|
+
const queue = await host.fetchQueueSize({ timeoutMs: p.timeoutMs });
|
|
5583
|
+
return {
|
|
5584
|
+
host,
|
|
5585
|
+
score: Math.max(queue, host.runsInFlight),
|
|
5586
|
+
error: null
|
|
5587
|
+
};
|
|
5588
|
+
} catch (err) {
|
|
5589
|
+
return {
|
|
5590
|
+
host,
|
|
5591
|
+
score: Infinity,
|
|
5592
|
+
error: extractErrorMessage(err)
|
|
5593
|
+
};
|
|
5594
|
+
}
|
|
5595
|
+
}));
|
|
5596
|
+
let best = null;
|
|
5597
|
+
for (const probe of probes) {
|
|
5598
|
+
if (probe.error != null) {
|
|
5599
|
+
console.warn(`🟡 leastBusy: host '${probe.host.data.id}' skipped: ${probe.error}`);
|
|
5600
|
+
continue;
|
|
5601
|
+
}
|
|
5602
|
+
if (best == null || probe.score < best.score) best = probe;
|
|
5603
|
+
}
|
|
5604
|
+
if (best == null) throw new Error(`🔴 leastBusy: no host answered (${probes.map((x) => `'${x.host.data.id}': ${x.error}`).join(", ")})`);
|
|
5605
|
+
return best.host;
|
|
5606
|
+
}
|
|
5569
5607
|
//#endregion
|
|
5570
5608
|
//#region src/utils/downloadFile.ts
|
|
5571
5609
|
async function downloadFile(url, outputPath, logPrefix = " - ") {
|
|
@@ -6182,6 +6220,10 @@ var ComfyTS = class ComfyTS {
|
|
|
6182
6220
|
this.hosts.set(data.id, created);
|
|
6183
6221
|
return created;
|
|
6184
6222
|
}
|
|
6223
|
+
/** the host with the shortest queue, for `wf.run({ host: await comfy.leastBusy([a, b]) })` */
|
|
6224
|
+
leastBusy(hosts, p = {}) {
|
|
6225
|
+
return leastBusy(hosts, p);
|
|
6226
|
+
}
|
|
6185
6227
|
get registry() {
|
|
6186
6228
|
if (this._registry == null) this._registry = new ComfyRegistry({
|
|
6187
6229
|
check: false,
|
|
@@ -6261,6 +6303,6 @@ function comfyTsPackageDir(moduleUrl = import.meta.url) {
|
|
|
6261
6303
|
throw new Error(`[comfy-ts] no package.json found walking up from ${fileURLToPath(moduleUrl)}`);
|
|
6262
6304
|
}
|
|
6263
6305
|
//#endregion
|
|
6264
|
-
export { readableStringify as a,
|
|
6306
|
+
export { readableStringify as a, renderHttpBase as c, settingsPathFor as i, comfyTsPackageDir as n, ComfySchema as o, ComfyTS as r, writeHostFile as s, bundledExamplesDir as t };
|
|
6265
6307
|
|
|
6266
|
-
//# sourceMappingURL=exampleAssets-
|
|
6308
|
+
//# sourceMappingURL=exampleAssets-1NHndnNB.js.map
|