comfy-ts 1.0.0 → 1.2.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 +60 -11
- package/dist/cli.js +4 -4439
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +445 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7439 -340
- package/dist/index.d.ts +7457 -358
- package/dist/index.js +444 -172
- package/dist/index.js.map +1 -1
- package/dist/{run-tui-BFhba_oG.js → run-tui-BAdizWsO.js} +1244 -201
- package/dist/run-tui-BAdizWsO.js.map +1 -0
- package/dist/state-BYbxDgfr.js +5258 -0
- package/dist/state-BYbxDgfr.js.map +1 -0
- package/examples/README.md +32 -0
- package/examples/comfy-cloud/ace-step-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/anima-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/boogu-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/capybara-i2i.cflow.ts +85 -0
- package/examples/comfy-cloud/capybara-i2v.cflow.ts +90 -0
- package/examples/comfy-cloud/capybara-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/chroma-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/cloudHost.ts +41 -0
- package/examples/comfy-cloud/ernie-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/firered-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/flux1-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/flux1-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/flux2-i2i.cflow.ts +80 -0
- package/examples/comfy-cloud/flux2-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/hidream-i2i.cflow.ts +89 -0
- package/examples/comfy-cloud/hidream-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +93 -0
- package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +74 -0
- package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +80 -0
- package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +95 -0
- package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +60 -0
- package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/krea2-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/lens-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/longcat-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/longcat-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/ltxv-i2v.cflow.ts +92 -0
- package/examples/comfy-cloud/ltxv-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/newbie-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +86 -0
- package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/ovis-t2i.cflow.ts +56 -0
- package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +69 -0
- package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +55 -0
- package/examples/comfy-cloud/sd35-t2i.cflow.ts +48 -0
- package/examples/comfy-cloud/sdk.d.ts +445 -57
- package/examples/comfy-cloud/sdxl-t2i.cflow.ts +69 -0
- package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +53 -0
- package/examples/comfy-cloud/svd-i2v.cflow.ts +75 -0
- package/examples/comfy-cloud/wan21-i2v.cflow.ts +83 -0
- package/examples/comfy-cloud/wan21-t2v.cflow.ts +64 -0
- package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +69 -0
- package/examples/comfy-cloud/wan22-i2v.cflow.ts +107 -0
- package/examples/comfy-cloud/wan22-t2v.cflow.ts +98 -0
- package/examples/comfy-cloud/z-image-t2i.cflow.ts +62 -0
- package/examples/images/README.md +18 -0
- package/examples/images/bear_1024x1024.jpg +0 -0
- package/examples/images/deer_768x1344.jpg +0 -0
- package/examples/images/dog_512x512.jpg +0 -0
- package/examples/images/lioness_768x768.jpg +0 -0
- package/examples/images/pug_200x300.jpg +0 -0
- package/examples/images/walrus_1344x768.jpg +0 -0
- package/examples/{01-txt2img.cflow.ts → rvion/01-txt2img.cflow.ts} +1 -1
- package/examples/{02-img2img-upload.cflow.ts → rvion/02-img2img-upload.cflow.ts} +7 -18
- package/examples/{03-export-workflow-json.cflow.ts → rvion/03-export-workflow-json.cflow.ts} +1 -1
- package/examples/{04-krea2-turbo-t2i.cflow.ts → rvion/04-krea2-turbo-t2i.cflow.ts} +2 -2
- package/examples/rvion/05-comfy-cloud.cflow.ts +51 -0
- package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
- package/guide-for-agents.md +7 -1
- package/package.json +18 -4
- package/src/cli/tui/components/CopyOverlay.tsx +25 -0
- package/src/cli/tui/components/Header.tsx +9 -4
- package/src/cli/tui/components/HostPanel.tsx +3 -2
- package/src/cli/tui/components/HostsOverlay.tsx +33 -0
- package/src/cli/tui/components/PreviewPanel.tsx +9 -8
- package/src/cli/tui/components/StatusBar.tsx +39 -9
- package/src/cli/tui/components/TreePanel.tsx +17 -7
- package/src/cli/tui/components/TuiApp.tsx +65 -5
- package/src/cli/tui/discoverWorkflows.ts +7 -41
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +72 -0
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +288 -0
- package/src/cli/tui/imagePicker/fsListing.ts +48 -0
- package/src/cli/tui/imagePicker/pickerPrefs.ts +78 -0
- package/src/cli/tui/run-tui.tsx +49 -8
- package/src/cli/tui/state/DraftsSt.ts +3 -2
- package/src/cli/tui/state/ExecSt.ts +108 -12
- package/src/cli/tui/state/HostSt.ts +94 -10
- package/src/cli/tui/state/LorasSt.ts +14 -36
- package/src/cli/tui/state/PickerSt.ts +8 -2
- package/src/cli/tui/state/PreviewSt.ts +28 -2
- package/src/cli/tui/state/QueueSt.ts +2 -2
- package/src/cli/tui/state/SettingsSt.ts +25 -7
- package/src/cli/tui/state/TreeSt.ts +139 -36
- package/src/cli/tui/state/TuiSt.ts +53 -6
- package/src/cli/tui/state/WorkflowsSt.ts +14 -2
- package/src/cli/tui/treeRows.ts +165 -0
- package/src/exampleAssets.ts +56 -0
- package/src/graph/ComfyNode.ts +4 -1
- package/src/host/ComfyHost.ts +7 -0
- package/src/index.ts +7 -0
- package/src/manager/ComfyRegistry.ts +37 -9
- package/src/manager/generated/KnownComfyCustomNodeName.ts +23852 -1926
- package/src/manager/generated/KnownComfyPluginTitle.ts +6854 -236
- package/src/manager/generated/KnownComfyPluginURL.ts +3425 -111
- package/src/manager/generated/KnownModel_Base.ts +23 -7
- package/src/manager/generated/KnownModel_FileName.ts +421 -0
- package/src/manager/generated/KnownModel_Name.ts +421 -0
- package/src/manager/generated/KnownModel_SavePath.ts +34 -8
- package/src/manager/generated/KnownModel_Type.ts +18 -14
- package/src/manager/json/alter-list.json +221 -221
- package/src/manager/json/custom-node-list.json +61020 -21946
- package/src/manager/json/extension-node-map.json +81077 -31176
- package/src/manager/json/github-stats.json +29321 -12601
- package/src/manager/json/model-list.json +5935 -4997
- package/src/manager/loaders/parseReport.ts +55 -0
- package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +15 -49
- package/src/manager/loaders/step2_custom-node-list-loader.ts +38 -83
- package/src/manager/loaders/step3_extension-node-map-loader.ts +36 -142
- package/src/manager/loaders/step4_model-list-loader.ts +25 -36
- package/src/manager/loaders/step5_alter-list-loader.ts +29 -0
- package/src/manager/loaders/step6_github-stats-loader.ts +23 -0
- package/src/manager/script-update-manager.bun.ts +9 -1
- package/src/manager/types/ComfyManagerAlterInfo.ts +13 -0
- package/src/manager/types/ComfyManagerFileModelInfo.ts +7 -3
- package/src/manager/types/ComfyManagerFilePluginContent.ts +6 -9
- package/src/manager/types/ComfyManagerFilePluginList.ts +3 -3
- package/src/manager/types/ComfyManagerGithubStats.ts +9 -0
- package/src/manager/types/ComfyManagerPluginContentMetadata.ts +2 -3
- package/src/manager/types/ComfyManagerPluginInfo.ts +48 -34
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/sdk-generator/ComfySchema.ts +14 -1
- package/src/sdk-generator/comfyui-sdk-codegen.ts +15 -0
- package/src/sdk-generator/inputWidgetKind.ts +17 -0
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +106 -5
- package/src/vars/DefinedWorkflow.ts +28 -10
- package/dist/DefinedWorkflow-O3ynII3Y.js +0 -598
- package/dist/DefinedWorkflow-O3ynII3Y.js.map +0 -1
- package/dist/run-tui-BFhba_oG.js.map +0 -1
- package/examples/05-comfy-cloud.cflow.ts +0 -67
- package/src/utils/tryExtracting.ts +0 -41
package/dist/index.cjs
CHANGED
|
@@ -33,13 +33,14 @@ let node_crypto = require("node:crypto");
|
|
|
33
33
|
node_crypto = __toESM(node_crypto, 1);
|
|
34
34
|
let ws = require("ws");
|
|
35
35
|
ws = __toESM(ws, 1);
|
|
36
|
+
let node_os = require("node:os");
|
|
36
37
|
let mobx = require("mobx");
|
|
37
38
|
let node_https = require("node:https");
|
|
38
39
|
node_https = __toESM(node_https, 1);
|
|
39
40
|
let node_process = require("node:process");
|
|
40
|
-
let
|
|
41
|
+
let node_url = require("node:url");
|
|
41
42
|
//#region package.json
|
|
42
|
-
var version = "1.
|
|
43
|
+
var version = "1.2.0";
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
45
46
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -738,6 +739,21 @@ const parseContainer = (template) => {
|
|
|
738
739
|
requiredCount: isRecord(input) && isRecord(input["required"]) && Object.keys(input["required"]).length > 0 ? Math.min(min, names.length) : 0
|
|
739
740
|
};
|
|
740
741
|
};
|
|
742
|
+
/**
|
|
743
|
+
* the single template sub-input's slot type of an autogrow container
|
|
744
|
+
* (`'IMAGE'` for TextEncodeBooguEdit.images). null when opts are not an
|
|
745
|
+
* autogrow template or the template has several sub-inputs (corpus-absent
|
|
746
|
+
* 2026-07-30, 27/27 single on the cloud catalog) — then codegen emits no
|
|
747
|
+
* typed instance keys and the container stays builderBase territory.
|
|
748
|
+
*/
|
|
749
|
+
const containerInstanceSlotType = (opts) => {
|
|
750
|
+
const template = (isRecord(opts) ? opts : null)?.["template"];
|
|
751
|
+
if (!isRecord(template) || !isRecord(template["input"])) return null;
|
|
752
|
+
const subs = flattenInputSections(template["input"]);
|
|
753
|
+
const first = subs[0];
|
|
754
|
+
if (subs.length !== 1 || first == null || typeof first.type !== "string") return null;
|
|
755
|
+
return first.type;
|
|
756
|
+
};
|
|
741
757
|
const classifyWidgetInput = (p) => {
|
|
742
758
|
const o = isRecord(p.opts) ? p.opts : null;
|
|
743
759
|
if (o?.["forceInput"] === true) return { kind: "slot" };
|
|
@@ -1250,7 +1266,7 @@ var ComfyNode = class ComfyNode {
|
|
|
1250
1266
|
for (const i of this.$schema.inputs) {
|
|
1251
1267
|
_done.add(i.nameInComfy);
|
|
1252
1268
|
const value = this.serializeValue(i.nameInComfy, promptExt.inputs[i.nameInComfy]);
|
|
1253
|
-
inputs[i.nameInComfy] = value;
|
|
1269
|
+
if (value !== void 0) inputs[i.nameInComfy] = value;
|
|
1254
1270
|
}
|
|
1255
1271
|
for (const [nameInComfy, rawVal] of Object.entries(promptExt.inputs)) {
|
|
1256
1272
|
if (_done.has(nameInComfy)) continue;
|
|
@@ -2198,8 +2214,8 @@ function comfyWorkflowAutoLayout(p) {
|
|
|
2198
2214
|
if (cols[at]) cols[at].push(node);
|
|
2199
2215
|
else cols[at] = [node];
|
|
2200
2216
|
}
|
|
2201
|
-
const HSEP = p?.node_hsep ??
|
|
2202
|
-
const VSEP = p?.node_vsep ??
|
|
2217
|
+
const HSEP = p?.node_hsep ?? 100;
|
|
2218
|
+
const VSEP = p?.node_vsep ?? 40;
|
|
2203
2219
|
let colX = 0;
|
|
2204
2220
|
let maxY = 0;
|
|
2205
2221
|
for (const col of cols) {
|
|
@@ -2627,6 +2643,15 @@ function codegenSDK(opts) {
|
|
|
2627
2643
|
for (const n of nodes) {
|
|
2628
2644
|
p(`${escapeJSKey(n.nodeKey)}: {`);
|
|
2629
2645
|
for (const i of n.inputs) {
|
|
2646
|
+
const kind = classifySchemaInput(i);
|
|
2647
|
+
if (kind.kind === "dynamic-container") {
|
|
2648
|
+
const instType = containerInstanceSlotType(i.opts);
|
|
2649
|
+
if (instType != null) kind.instanceNames.forEach((instName, ix) => {
|
|
2650
|
+
const opt = ix >= kind.requiredCount ? "?" : "";
|
|
2651
|
+
p(` ${escapeJSKey(`${i.nameInComfy}.${instName}`)}${opt}: Accepts[${JSON.stringify(instType)}]`);
|
|
2652
|
+
});
|
|
2653
|
+
continue;
|
|
2654
|
+
}
|
|
2630
2655
|
const opts_ = typeof i.opts === "string" ? null : i.opts;
|
|
2631
2656
|
let type = `Accepts[${JSON.stringify(i.typeName)}]`;
|
|
2632
2657
|
const comboOptions = i.typeName === "COMBO" && Array.isArray(opts_?.options) ? opts_.options.filter((o) => typeof o === "string" || typeof o === "number" || typeof o === "boolean") : [];
|
|
@@ -2946,9 +2971,18 @@ var ComfySchema = class {
|
|
|
2946
2971
|
comfyUnionDef: slotType
|
|
2947
2972
|
}).unionName);
|
|
2948
2973
|
else throw new Error(`invalid schema (${JSON.stringify(slotType)}) for input "${ipt.name}" in node "${nodeNameInComfy}" (type: ${typeof slotType}; expected: Array | string)`);
|
|
2974
|
+
const isAutogrowContainer = typeof slotType === "string" && classifyWidgetInput({
|
|
2975
|
+
name: ipt.name,
|
|
2976
|
+
type: slotType,
|
|
2977
|
+
opts: slotOpts
|
|
2978
|
+
}).kind === "dynamic-container";
|
|
2979
|
+
if (isAutogrowContainer) {
|
|
2980
|
+
const instType = containerInstanceSlotType(slotOpts);
|
|
2981
|
+
if (instType != null) this.knownSlotTypes.add(asComfyNodeSlotTypeName(instType));
|
|
2982
|
+
}
|
|
2949
2983
|
node.inputs.push({
|
|
2950
2984
|
slotName: inputSlotName,
|
|
2951
|
-
required: ipt.required,
|
|
2985
|
+
required: ipt.required && !isAutogrowContainer,
|
|
2952
2986
|
nameInComfy: inputNameInComfy,
|
|
2953
2987
|
nameInComfyEscaped: escapeJSKey(inputNameInComfy),
|
|
2954
2988
|
typeName: inputTypeName,
|
|
@@ -3912,16 +3946,38 @@ const DEFAULT_SIZE_PRESETS = [
|
|
|
3912
3946
|
height: 1344
|
|
3913
3947
|
}
|
|
3914
3948
|
];
|
|
3915
|
-
/** width/height picker: presets + free `WxH` entry
|
|
3949
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
3950
|
+
* size of a linked image var (his ask 2026-07-30: the widget shows
|
|
3951
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
3916
3952
|
var SizeVar = class extends ComfyVar {
|
|
3917
3953
|
constructor(defaultValue = {
|
|
3918
3954
|
width: 1024,
|
|
3919
3955
|
height: 1024
|
|
3920
|
-
}, presets = DEFAULT_SIZE_PRESETS, label) {
|
|
3956
|
+
}, presets = DEFAULT_SIZE_PRESETS, label, imageVar) {
|
|
3921
3957
|
super(defaultValue, label);
|
|
3922
3958
|
this.presets = presets;
|
|
3959
|
+
this.imageVar = imageVar;
|
|
3923
3960
|
this.kind = "size";
|
|
3924
3961
|
}
|
|
3962
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
3963
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
3964
|
+
* image var itself, the size row simply disappears) */
|
|
3965
|
+
imageSize() {
|
|
3966
|
+
const iv = this.imageVar;
|
|
3967
|
+
if (iv == null || iv.value === "") return null;
|
|
3968
|
+
try {
|
|
3969
|
+
const abs = iv.absPath();
|
|
3970
|
+
const meta = (0, image_meta.imageMeta)(new Uint8Array((0, node_fs.readFileSync)(abs)));
|
|
3971
|
+
if (meta.width == null || meta.height == null) return null;
|
|
3972
|
+
return {
|
|
3973
|
+
width: meta.width,
|
|
3974
|
+
height: meta.height,
|
|
3975
|
+
name: (0, pathe.basename)(abs)
|
|
3976
|
+
};
|
|
3977
|
+
} catch {
|
|
3978
|
+
return null;
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3925
3981
|
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
3926
3982
|
parse(raw) {
|
|
3927
3983
|
const m = raw.trim().match(/^(\d+)\s*[x×]\s*(\d+)$/);
|
|
@@ -3948,7 +4004,73 @@ var SizeVar = class extends ComfyVar {
|
|
|
3948
4004
|
return `${width}×${height}${hit ? ` (${hit.label})` : ""}`;
|
|
3949
4005
|
}
|
|
3950
4006
|
};
|
|
3951
|
-
|
|
4007
|
+
const DEFAULT_IMAGE_EXTENSIONS = [
|
|
4008
|
+
"png",
|
|
4009
|
+
"jpg",
|
|
4010
|
+
"jpeg",
|
|
4011
|
+
"webp",
|
|
4012
|
+
"gif"
|
|
4013
|
+
];
|
|
4014
|
+
/** empty image var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
4015
|
+
var ImageVarEmptyError = class extends Error {
|
|
4016
|
+
constructor(varName) {
|
|
4017
|
+
super(`image var '${varName}' is empty — pick a file (TUI: activate the var; script: .set('/path/to/image.png'))`);
|
|
4018
|
+
this.varName = varName;
|
|
4019
|
+
}
|
|
4020
|
+
};
|
|
4021
|
+
/** trim + expand a leading `~/` — every ImageVar write funnels through this */
|
|
4022
|
+
function expandUserPath(raw) {
|
|
4023
|
+
const trimmed = raw.trim();
|
|
4024
|
+
return trimmed.startsWith("~/") ? (0, pathe.join)((0, node_os.homedir)(), trimmed.slice(2)) : trimmed;
|
|
4025
|
+
}
|
|
4026
|
+
/**
|
|
4027
|
+
* a local image path. The VALUE is a PLAIN PATH STRING — text-encodable,
|
|
4028
|
+
* drafts persist it verbatim (toJSON = the string), hand-editable in the
|
|
4029
|
+
* draft json. Empty = unset: outValue()/absPath() throw ImageVarEmptyError,
|
|
4030
|
+
* so a build never runs on a silent placeholder. The TUI opens the image
|
|
4031
|
+
* picker overlay for kind 'image'.
|
|
4032
|
+
*/
|
|
4033
|
+
var ImageVar = class extends ComfyVar {
|
|
4034
|
+
constructor(defaultValue, opts = {}) {
|
|
4035
|
+
super(expandUserPath(defaultValue), opts.label);
|
|
4036
|
+
this.opts = opts;
|
|
4037
|
+
this.kind = "image";
|
|
4038
|
+
}
|
|
4039
|
+
/** what the picker lists (lowercase, no dots) */
|
|
4040
|
+
get extensions() {
|
|
4041
|
+
return this.opts.extensions ?? DEFAULT_IMAGE_EXTENSIONS;
|
|
4042
|
+
}
|
|
4043
|
+
set(value) {
|
|
4044
|
+
return super.set(expandUserPath(value));
|
|
4045
|
+
}
|
|
4046
|
+
parse(raw) {
|
|
4047
|
+
this.set(raw);
|
|
4048
|
+
return true;
|
|
4049
|
+
}
|
|
4050
|
+
isSet() {
|
|
4051
|
+
return this.value !== "";
|
|
4052
|
+
}
|
|
4053
|
+
emptyError() {
|
|
4054
|
+
return new ImageVarEmptyError(this.name ?? this.label ?? "image");
|
|
4055
|
+
}
|
|
4056
|
+
/** the ONE resolution helper: absolute kept as-is, relative resolved against opts.folder, else cwd */
|
|
4057
|
+
absPath() {
|
|
4058
|
+
if (!this.isSet()) throw this.emptyError();
|
|
4059
|
+
if ((0, pathe.isAbsolute)(this.value)) return this.value;
|
|
4060
|
+
return (0, pathe.resolve)(this.opts.folder ?? process.cwd(), this.value);
|
|
4061
|
+
}
|
|
4062
|
+
/** empty = unset: the build fails LOUD here (varValues calls outValue) */
|
|
4063
|
+
outValue() {
|
|
4064
|
+
if (!this.isSet()) throw this.emptyError();
|
|
4065
|
+
return this.value;
|
|
4066
|
+
}
|
|
4067
|
+
display() {
|
|
4068
|
+
if (!this.isSet()) return "(unset) pick a file";
|
|
4069
|
+
const home = (0, node_os.homedir)();
|
|
4070
|
+
return this.value.startsWith(`${home}/`) ? `~${this.value.slice(home.length)}` : this.value;
|
|
4071
|
+
}
|
|
4072
|
+
};
|
|
4073
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image */
|
|
3952
4074
|
const v = {
|
|
3953
4075
|
text: (defaultValue, label) => new TextVar(defaultValue, label),
|
|
3954
4076
|
prompt: (defaultValue, opts = {}) => new PromptVar(defaultValue, opts),
|
|
@@ -3958,7 +4080,8 @@ const v = {
|
|
|
3958
4080
|
toggle: (defaultValue, label) => new ToggleVar(defaultValue, label),
|
|
3959
4081
|
choice: (choices, defaultValue, label) => new ChoiceVar(choices, defaultValue, label),
|
|
3960
4082
|
loras: (options, initial = {}, label) => new LorasVar(options, initial, label),
|
|
3961
|
-
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets, opts.label)
|
|
4083
|
+
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets, opts.label, opts.image),
|
|
4084
|
+
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts)
|
|
3962
4085
|
};
|
|
3963
4086
|
function varValues(vars) {
|
|
3964
4087
|
const out = {};
|
|
@@ -3982,7 +4105,10 @@ var DefinedWorkflow = class {
|
|
|
3982
4105
|
this.lastWorkflow = null;
|
|
3983
4106
|
this.lastExecution = null;
|
|
3984
4107
|
this.vars = isVarsThunk(spec.vars) ? spec.vars(v) : spec.vars;
|
|
3985
|
-
for (const [, varDef] of this.entries())
|
|
4108
|
+
for (const [key, varDef] of this.entries()) {
|
|
4109
|
+
varDef.name = key;
|
|
4110
|
+
varDef.bindHost?.(this.host);
|
|
4111
|
+
}
|
|
3986
4112
|
}
|
|
3987
4113
|
/** [name, var] pairs, for drivers that enumerate the knobs */
|
|
3988
4114
|
entries() {
|
|
@@ -3993,10 +4119,12 @@ var DefinedWorkflow = class {
|
|
|
3993
4119
|
* (set by run()) fires each var's afterRun() right after snapshotting the
|
|
3994
4120
|
* values — atomically, before any await — so the graph uses this run's seed
|
|
3995
4121
|
* while the var moves to the next (queued runs get distinct seeds; a bare
|
|
3996
|
-
* build() for copy/export never advances).
|
|
4122
|
+
* build() for copy/export never advances). `p.host` substitutes the host
|
|
4123
|
+
* the graph is built against (TUI host override): node/model availability
|
|
4124
|
+
* there surfaces as workflow.problems / server validation, by design.
|
|
3997
4125
|
*/
|
|
3998
4126
|
async build(p = {}) {
|
|
3999
|
-
const wf = this.host.workflow({ id: this.spec.id });
|
|
4127
|
+
const wf = (p.host ?? this.host).workflow({ id: this.spec.id });
|
|
4000
4128
|
const values = varValues(this.vars);
|
|
4001
4129
|
if (p.advance) for (const varDef of Object.values(this.vars)) varDef.afterRun();
|
|
4002
4130
|
await this.spec.build(wf.builder, values, wf);
|
|
@@ -4004,10 +4132,20 @@ var DefinedWorkflow = class {
|
|
|
4004
4132
|
return wf;
|
|
4005
4133
|
}
|
|
4006
4134
|
/** build a fresh graph from the current var values, send it, wait for outputs.
|
|
4007
|
-
* connects first (idempotent) — modules can import offline from the schema cache
|
|
4135
|
+
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
4136
|
+
* `settings.host` runs against THAT host instead of the defining one. */
|
|
4008
4137
|
async run(settings = {}) {
|
|
4009
|
-
|
|
4010
|
-
|
|
4138
|
+
const host = settings.host ?? this.host;
|
|
4139
|
+
await host.connect();
|
|
4140
|
+
const execution = await (await this.build({
|
|
4141
|
+
advance: true,
|
|
4142
|
+
host
|
|
4143
|
+
})).run({
|
|
4144
|
+
saveFormat: settings.saveFormat,
|
|
4145
|
+
idMode: settings.idMode,
|
|
4146
|
+
log: settings.log,
|
|
4147
|
+
onProgress: settings.onProgress
|
|
4148
|
+
});
|
|
4011
4149
|
this.lastExecution = execution;
|
|
4012
4150
|
return execution;
|
|
4013
4151
|
}
|
|
@@ -4264,6 +4402,7 @@ var ComfyHost = class {
|
|
|
4264
4402
|
this.comfySessionId = "temp";
|
|
4265
4403
|
this._unknownBinaryFrameTypes = /* @__PURE__ */ new Set();
|
|
4266
4404
|
this.status = null;
|
|
4405
|
+
this.lastWsMessageAt = null;
|
|
4267
4406
|
this.base = parseHostBase(this.data);
|
|
4268
4407
|
/** folder where file related to the host config will be cached */
|
|
4269
4408
|
this.cacheFolder = comfyts.resolveFromHosts(this.data.id);
|
|
@@ -4417,6 +4556,7 @@ var ComfyHost = class {
|
|
|
4417
4556
|
prompt.onPromptRelatedMessage(msg);
|
|
4418
4557
|
}
|
|
4419
4558
|
onMessage(e) {
|
|
4559
|
+
this.lastWsMessageAt = Date.now();
|
|
4420
4560
|
if (this.data.onWsMessageAny) this.data.onWsMessageAny(e);
|
|
4421
4561
|
if (e.data instanceof ArrayBuffer) {
|
|
4422
4562
|
const frame = parseBinaryWsFrame(e.data);
|
|
@@ -4540,31 +4680,19 @@ function downloadFile(url, outputPath, logPrefix = " - ") {
|
|
|
4540
4680
|
}
|
|
4541
4681
|
//#endregion
|
|
4542
4682
|
//#region src/manager/loaders/step1_downloadComfyManagerJSONs.ts
|
|
4683
|
+
const MANAGER_RAW_BASE = "https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main";
|
|
4684
|
+
const MANAGER_MIRROR_FILES = [
|
|
4685
|
+
"custom-node-list.json",
|
|
4686
|
+
"model-list.json",
|
|
4687
|
+
"extension-node-map.json",
|
|
4688
|
+
"alter-list.json",
|
|
4689
|
+
"github-stats.json"
|
|
4690
|
+
];
|
|
4543
4691
|
async function DownloadComfyManagerJSONs() {
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
await SYNC_githubStats();
|
|
4549
|
-
async function SYNC_modelList() {
|
|
4550
|
-
await downloadFile("https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json", "src/manager/json/model-list.json", `- downloading ynchronizing model-list.json...`);
|
|
4551
|
-
console.log(` saved at ${ansi.blue("src/manager/json/model-list.json")}`);
|
|
4552
|
-
}
|
|
4553
|
-
async function SYNC_customNodeList() {
|
|
4554
|
-
await downloadFile("https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json", "src/manager/json/custom-node-list.json", `- downloading synchronizing custom-node-list.json...`);
|
|
4555
|
-
console.log(` saved at ${ansi.blue("src/manager/json/custom-node-list.json")}`);
|
|
4556
|
-
}
|
|
4557
|
-
async function SYNC_extensionNodeMap() {
|
|
4558
|
-
await downloadFile("https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json", "src/manager/json/extension-node-map.json", `- downloading synchronizing extension-node-map.json...`);
|
|
4559
|
-
console.log(` saved at ${ansi.blue("src/manager/json/extension-node-map.json")}`);
|
|
4560
|
-
}
|
|
4561
|
-
async function SYNC_alterList() {
|
|
4562
|
-
await downloadFile("https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json", "src/manager/json/alter-list.json", `- downloading synchronizing alter-list.json...`);
|
|
4563
|
-
console.log(` saved at ${ansi.blue("src/manager/json/alter-list.json")}`);
|
|
4564
|
-
}
|
|
4565
|
-
async function SYNC_githubStats() {
|
|
4566
|
-
await downloadFile("https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/refs/heads/main/github-stats.json", "src/manager/json/github-stats.json", `- downloading ynchronizing githubStats.json...`);
|
|
4567
|
-
console.log(` saved at ${ansi.blue("src/manager/json/github-stats.json")}`);
|
|
4692
|
+
for (const file of MANAGER_MIRROR_FILES) {
|
|
4693
|
+
const dest = `src/manager/json/${file}`;
|
|
4694
|
+
await downloadFile(`${MANAGER_RAW_BASE}/${file}`, dest, `- downloading ${file}...`);
|
|
4695
|
+
console.log(` saved at ${ansi.blue(dest)}`);
|
|
4568
4696
|
}
|
|
4569
4697
|
}
|
|
4570
4698
|
//#endregion
|
|
@@ -4572,24 +4700,6 @@ async function DownloadComfyManagerJSONs() {
|
|
|
4572
4700
|
const githubRegexpV1 = /https:\/\/github.com\/(.+?)\/(.+?)\/?/;
|
|
4573
4701
|
const githubRegexpV2 = /https:\/\/github.com\/(.+?)\/([a-zA-Z0-9-_]+)?/;
|
|
4574
4702
|
//#endregion
|
|
4575
|
-
//#region src/utils/tryExtracting.ts
|
|
4576
|
-
function tryRecovering({ verbose = 0, property, hacks, onFail, onSuccess }) {
|
|
4577
|
-
if (verbose >= 2) console.log(`[🔶] trying to find a suitable value for ${property}...`);
|
|
4578
|
-
for (const hack of hacks) {
|
|
4579
|
-
if (verbose >= 2) console.log(` > trying to use ${hack.attempt}...`);
|
|
4580
|
-
const value = hack.fn();
|
|
4581
|
-
if (value != null) {
|
|
4582
|
-
if (verbose >= (hack.level ?? 1)) {
|
|
4583
|
-
if (verbose) console.log(` 🔶 recovered ${property} using ${hack.attempt}.`);
|
|
4584
|
-
}
|
|
4585
|
-
onSuccess?.(property, value);
|
|
4586
|
-
return value;
|
|
4587
|
-
}
|
|
4588
|
-
}
|
|
4589
|
-
onFail?.(property);
|
|
4590
|
-
throw new Error(`[🔶] ${property} could not be recovered`);
|
|
4591
|
-
}
|
|
4592
|
-
//#endregion
|
|
4593
4703
|
//#region src/manager/json/custom-node-list.extra.ts
|
|
4594
4704
|
const ComfyPluginExtra = [{
|
|
4595
4705
|
id: "TEMP_ComfyUI-BRIA_AI-RMBG",
|
|
@@ -4601,46 +4711,111 @@ const ComfyPluginExtra = [{
|
|
|
4601
4711
|
description: "better rembg ?"
|
|
4602
4712
|
}];
|
|
4603
4713
|
//#endregion
|
|
4714
|
+
//#region src/manager/loaders/parseReport.ts
|
|
4715
|
+
/** root shape of a manager mirror file is broken: nothing to salvage, fail loud */
|
|
4716
|
+
var ManagerParseError = class extends Error {
|
|
4717
|
+
constructor(file, detail) {
|
|
4718
|
+
super(`🔴 [manager] ${file} root shape invalid: ${detail}`);
|
|
4719
|
+
this.file = file;
|
|
4720
|
+
this.detail = detail;
|
|
4721
|
+
this.name = "ManagerParseError";
|
|
4722
|
+
}
|
|
4723
|
+
};
|
|
4724
|
+
var FileParseCounter = class {
|
|
4725
|
+
constructor(file) {
|
|
4726
|
+
this.file = file;
|
|
4727
|
+
this.total = 0;
|
|
4728
|
+
this.accepted = 0;
|
|
4729
|
+
this.skipped = /* @__PURE__ */ new Map();
|
|
4730
|
+
}
|
|
4731
|
+
ok() {
|
|
4732
|
+
this.total++;
|
|
4733
|
+
this.accepted++;
|
|
4734
|
+
}
|
|
4735
|
+
skip(reason, firstError) {
|
|
4736
|
+
this.total++;
|
|
4737
|
+
const prev = this.skipped.get(reason);
|
|
4738
|
+
if (prev == null) this.skipped.set(reason, {
|
|
4739
|
+
count: 1,
|
|
4740
|
+
firstError
|
|
4741
|
+
});
|
|
4742
|
+
else prev.count++;
|
|
4743
|
+
}
|
|
4744
|
+
};
|
|
4745
|
+
/** per-file row accounting for the manager mirror parse; printed on every registry build so upstream drift stays visible */
|
|
4746
|
+
var ManagerParseReport = class {
|
|
4747
|
+
constructor() {
|
|
4748
|
+
this.counters = [];
|
|
4749
|
+
}
|
|
4750
|
+
file(name) {
|
|
4751
|
+
const counter = new FileParseCounter(name);
|
|
4752
|
+
this.counters.push(counter);
|
|
4753
|
+
return counter;
|
|
4754
|
+
}
|
|
4755
|
+
print() {
|
|
4756
|
+
console.log(ansi.bold(`[📘 registry] parse report:`));
|
|
4757
|
+
for (const c of this.counters) {
|
|
4758
|
+
const skippedTotal = [...c.skipped.values()].reduce((acc, cur) => acc + cur.count, 0);
|
|
4759
|
+
const headline = ` ${c.file}: ${c.total} rows, ${c.accepted} accepted, ${skippedTotal} skipped`;
|
|
4760
|
+
console.log(skippedTotal === 0 ? headline : ansi.red(headline));
|
|
4761
|
+
for (const [reason, info] of c.skipped) console.log(ansi.red(` - ${reason} x${info.count}, first: ${info.firstError}`));
|
|
4762
|
+
}
|
|
4763
|
+
}
|
|
4764
|
+
};
|
|
4765
|
+
//#endregion
|
|
4766
|
+
//#region src/manager/types/ComfyManagerFilePluginList.ts
|
|
4767
|
+
const ComfyManagerFilePluginListRoot_ark = (0, arktype.type)({ custom_nodes: "unknown[]" });
|
|
4768
|
+
//#endregion
|
|
4604
4769
|
//#region src/manager/types/ComfyManagerPluginInfo.ts
|
|
4605
|
-
const
|
|
4770
|
+
const ComfyManagerRawPluginInfo_ark = (0, arktype.type)({
|
|
4606
4771
|
author: "string",
|
|
4607
4772
|
title: arktype.type.string.as(),
|
|
4608
4773
|
reference: "string",
|
|
4609
4774
|
files: arktype.type.string.as().array(),
|
|
4610
4775
|
install_type: "string",
|
|
4611
4776
|
description: "string",
|
|
4612
|
-
id: arktype.type.string.as(),
|
|
4777
|
+
"id?": arktype.type.string.as(),
|
|
4613
4778
|
"preemptions?": "string[]",
|
|
4614
4779
|
"pip?": "string[]",
|
|
4615
4780
|
"nodename_pattern?": "string",
|
|
4616
4781
|
"apt_dependency?": "string[]",
|
|
4617
4782
|
"js_path?": "string",
|
|
4618
4783
|
"version?": "string",
|
|
4619
|
-
"tags?": "string[]"
|
|
4784
|
+
"tags?": "string[]",
|
|
4785
|
+
"reference2?": "string",
|
|
4786
|
+
"category?": "string",
|
|
4787
|
+
"name?": "string",
|
|
4788
|
+
"license?": "string",
|
|
4789
|
+
"nickname?": "string",
|
|
4790
|
+
"stars?": "number",
|
|
4791
|
+
"last_update?": "string",
|
|
4792
|
+
"badges?": "string[]",
|
|
4793
|
+
"dependencies?": "string[]"
|
|
4620
4794
|
});
|
|
4621
4795
|
//#endregion
|
|
4622
|
-
//#region src/manager/types/ComfyManagerFilePluginList.ts
|
|
4623
|
-
const ComfyManagerFilePluginList_ark = (0, arktype.type)({ custom_nodes: ComfyManagerPluginInfo_ark.array() });
|
|
4624
|
-
//#endregion
|
|
4625
4796
|
//#region src/manager/loaders/step2_custom-node-list-loader.ts
|
|
4626
4797
|
const _getKnownPlugins = (DB) => {
|
|
4798
|
+
const counter = DB.report.file("custom-node-list.json");
|
|
4627
4799
|
let totalFileSeen = 0;
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
const
|
|
4631
|
-
for (const
|
|
4632
|
-
|
|
4633
|
-
plugin.title ??= tryRecoveringPluginTitle(plugin, 1);
|
|
4634
|
-
}
|
|
4635
|
-
const res = ComfyManagerFilePluginList_ark(knownPluginFile);
|
|
4636
|
-
if (DB.opts.check) {
|
|
4800
|
+
const root = ComfyManagerFilePluginListRoot_ark(JSON.parse((0, node_fs.readFileSync)("src/manager/json/custom-node-list.json", "utf8")));
|
|
4801
|
+
if (root instanceof arktype.type.errors) throw new ManagerParseError("custom-node-list.json", root.summary);
|
|
4802
|
+
const canonical = [];
|
|
4803
|
+
for (const row of root.custom_nodes) {
|
|
4804
|
+
const res = ComfyManagerRawPluginInfo_ark(row);
|
|
4637
4805
|
if (res instanceof arktype.type.errors) {
|
|
4638
|
-
|
|
4639
|
-
|
|
4806
|
+
counter.skip("schema", res.summary);
|
|
4807
|
+
continue;
|
|
4640
4808
|
}
|
|
4809
|
+
const plugin = normalizePluginInfo(res);
|
|
4810
|
+
if (plugin == null) {
|
|
4811
|
+
counter.skip("id-unrecoverable", res.reference);
|
|
4812
|
+
continue;
|
|
4813
|
+
}
|
|
4814
|
+
canonical.push(plugin);
|
|
4815
|
+
counter.ok();
|
|
4641
4816
|
}
|
|
4817
|
+
const knownPluginList = canonical.concat(ComfyPluginExtra);
|
|
4642
4818
|
for (const plugin of knownPluginList) {
|
|
4643
|
-
totalPluginSeen++;
|
|
4644
4819
|
if (DB.opts.check && DB.plugins_byTitle.has(plugin.title)) console.log(` ❌ plugin.title: "${plugin.title}" is duplicated`);
|
|
4645
4820
|
DB.plugins_byTitle.set(plugin.title, plugin);
|
|
4646
4821
|
for (const pluginURI of plugin.files) {
|
|
@@ -4651,7 +4826,7 @@ const _getKnownPlugins = (DB) => {
|
|
|
4651
4826
|
}
|
|
4652
4827
|
if (DB.opts.genTypes) {
|
|
4653
4828
|
let out1 = "";
|
|
4654
|
-
const allPluginsSortedByTitles = [...DB.plugins_byTitle.values()].sort((a, b) =>
|
|
4829
|
+
const allPluginsSortedByTitles = [...DB.plugins_byTitle.values()].sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()));
|
|
4655
4830
|
out1 += "// prettier-ignore\n";
|
|
4656
4831
|
out1 += "export type KnownComfyPluginTitle =\n";
|
|
4657
4832
|
for (const plugin of allPluginsSortedByTitles) {
|
|
@@ -4660,7 +4835,7 @@ const _getKnownPlugins = (DB) => {
|
|
|
4660
4835
|
}
|
|
4661
4836
|
out1 += "\n";
|
|
4662
4837
|
const out1Path = "src/manager/generated/KnownComfyPluginTitle.ts";
|
|
4663
|
-
(0,
|
|
4838
|
+
(0, node_fs.writeFileSync)(out1Path, out1 + "\n", "utf-8");
|
|
4664
4839
|
console.log(` > generated: ${ansi.blue.underline(out1Path)}`);
|
|
4665
4840
|
let out2 = "";
|
|
4666
4841
|
const sortedFileNames = [...DB.plugins_byFile.keys()].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
@@ -4668,47 +4843,33 @@ const _getKnownPlugins = (DB) => {
|
|
|
4668
4843
|
out2 += "export type KnownComfyPluginURL =\n";
|
|
4669
4844
|
for (const fileName of sortedFileNames) out2 += ` | ${JSON.stringify(fileName)}\n`;
|
|
4670
4845
|
const out2Path = "src/manager/generated/KnownComfyPluginURL.ts";
|
|
4671
|
-
(0,
|
|
4846
|
+
(0, node_fs.writeFileSync)(out2Path, out2, "utf-8");
|
|
4672
4847
|
console.log(` > generated: ${ansi.blue.underline(out2Path)}`);
|
|
4673
4848
|
}
|
|
4674
4849
|
if (DB.opts.check) {
|
|
4675
|
-
console.log(` - ${
|
|
4850
|
+
console.log(` - ${knownPluginList.length} CustomNodes in file`);
|
|
4676
4851
|
console.log(` - ${DB.plugins_byTitle.size} CustomNodes registered in map`);
|
|
4677
4852
|
console.log(` - ${totalFileSeen} CustomNodes-File Seen`);
|
|
4678
4853
|
console.log(` - ${DB.plugins_byFile.size} CustomNodes-File registered in map`);
|
|
4679
4854
|
}
|
|
4680
4855
|
};
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
}
|
|
4693
|
-
}
|
|
4694
|
-
function tryRecoveringPluginId(plugin, verbose = 0) {
|
|
4695
|
-
return tryRecovering({
|
|
4696
|
-
property: "plugin.id",
|
|
4697
|
-
verbose,
|
|
4698
|
-
hacks: [{
|
|
4699
|
-
level: 2,
|
|
4700
|
-
attempt: "title",
|
|
4701
|
-
fn: () => plugin.title
|
|
4702
|
-
}, {
|
|
4703
|
-
attempt: "github repo name",
|
|
4704
|
-
fn: () => plugin.reference.match(githubRegexpV1)?.[2]
|
|
4705
|
-
}]
|
|
4706
|
-
});
|
|
4856
|
+
/**
|
|
4857
|
+
* raw → canonical: recover the missing `id` (absent on ~76% of upstream rows)
|
|
4858
|
+
* from the title, else the github repo name. null = unrecoverable, caller
|
|
4859
|
+
* reports and skips the row.
|
|
4860
|
+
*/
|
|
4861
|
+
function normalizePluginInfo(p) {
|
|
4862
|
+
const id = p.id ?? p.title ?? p.reference.match(githubRegexpV1)?.[2];
|
|
4863
|
+
if (id == null) return null;
|
|
4864
|
+
return {
|
|
4865
|
+
...p,
|
|
4866
|
+
id
|
|
4867
|
+
};
|
|
4707
4868
|
}
|
|
4708
4869
|
//#endregion
|
|
4709
4870
|
//#region src/manager/types/ComfyManagerPluginContentMetadata.ts
|
|
4710
4871
|
const ComfyManagerPluginContentMetadata_ark = (0, arktype.type)({
|
|
4711
|
-
title_aux: arktype.type.string.or(arktype.type.null),
|
|
4872
|
+
"title_aux?": arktype.type.string.or(arktype.type.null),
|
|
4712
4873
|
"author?": "string",
|
|
4713
4874
|
"nickname?": "string",
|
|
4714
4875
|
"description?": "string",
|
|
@@ -4722,42 +4883,37 @@ const ComfyManagerPluginContentNodeName_ark = arktype.type.string.as();
|
|
|
4722
4883
|
(0, arktype.type)("string");
|
|
4723
4884
|
//#endregion
|
|
4724
4885
|
//#region src/manager/types/ComfyManagerFilePluginContent.ts
|
|
4725
|
-
const
|
|
4886
|
+
const ComfyManagerExtensionNodeMapEntry_ark = (0, arktype.type)([ComfyManagerPluginContentNodeName_ark.array(), ComfyManagerPluginContentMetadata_ark]);
|
|
4726
4887
|
//#endregion
|
|
4727
4888
|
//#region src/manager/loaders/step3_extension-node-map-loader.ts
|
|
4728
4889
|
const _getCustomNodeRegistry = (DB) => {
|
|
4890
|
+
const counter = DB.report.file("extension-node-map.json");
|
|
4729
4891
|
let totalCustomNodeSeen = 0;
|
|
4730
|
-
const
|
|
4731
|
-
const
|
|
4732
|
-
if (
|
|
4892
|
+
const raw = JSON.parse((0, node_fs.readFileSync)("src/manager/json/extension-node-map.json", "utf8"));
|
|
4893
|
+
const root = (0, arktype.type)("Record<string, unknown>")(raw);
|
|
4894
|
+
if (root instanceof arktype.type.errors) throw new ManagerParseError("extension-node-map.json", root.summary);
|
|
4895
|
+
for (const [url, value] of Object.entries(root)) {
|
|
4896
|
+
const res = ComfyManagerExtensionNodeMapEntry_ark(value);
|
|
4733
4897
|
if (res instanceof arktype.type.errors) {
|
|
4734
|
-
|
|
4735
|
-
|
|
4898
|
+
counter.skip("schema", `${url}: ${res.summary}`);
|
|
4899
|
+
continue;
|
|
4736
4900
|
}
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
meta,
|
|
4747
|
-
plugin: confyPlugin,
|
|
4748
|
-
pythonModule: reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(confyPlugin, url, meta)
|
|
4749
|
-
};
|
|
4750
|
-
});
|
|
4751
|
-
for (const enmEntry of enmEntries) {
|
|
4752
|
-
totalCustomNodeSeen += enmEntry.comfyNodeNames.length;
|
|
4753
|
-
const plugin = enmEntry.plugin;
|
|
4901
|
+
const plugin = DB.plugins_byFile.get(url);
|
|
4902
|
+
if (plugin == null) {
|
|
4903
|
+
counter.skip("unknown-plugin-url", url);
|
|
4904
|
+
continue;
|
|
4905
|
+
}
|
|
4906
|
+
counter.ok();
|
|
4907
|
+
const comfyNodeNames = res[0];
|
|
4908
|
+
totalCustomNodeSeen += comfyNodeNames.length;
|
|
4909
|
+
const pythonModule = reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(plugin);
|
|
4754
4910
|
const nodesInPlugin = DB.customNodes_byPluginName.get(plugin.title) ?? [];
|
|
4755
4911
|
DB.customNodes_byPluginName.set(plugin.title, nodesInPlugin);
|
|
4756
|
-
for (const nodeNameInComfy of
|
|
4757
|
-
const nodeKey = toQualifiedNodeKey(
|
|
4758
|
-
const
|
|
4759
|
-
if (
|
|
4760
|
-
else
|
|
4912
|
+
for (const nodeNameInComfy of comfyNodeNames) {
|
|
4913
|
+
const nodeKey = toQualifiedNodeKey(pythonModule, nodeNameInComfy);
|
|
4914
|
+
const prevEntry = DB.plugins_byNodeKey.get(nodeKey);
|
|
4915
|
+
if (prevEntry == null) DB.plugins_byNodeKey.set(nodeKey, [plugin]);
|
|
4916
|
+
else prevEntry.push(plugin);
|
|
4761
4917
|
nodesInPlugin.push(nodeKey);
|
|
4762
4918
|
}
|
|
4763
4919
|
}
|
|
@@ -4766,23 +4922,22 @@ const _getCustomNodeRegistry = (DB) => {
|
|
|
4766
4922
|
const sortedNodeKeys = [...DB.plugins_byNodeKey.keys()].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
4767
4923
|
out += "// prettier-ignore\n";
|
|
4768
4924
|
out += "export type KnownComfyCustomNodeName =\n";
|
|
4769
|
-
for (const nodeName of sortedNodeKeys) {
|
|
4770
|
-
if (nodeName === "sd_perturbed_attention.PerturbedAttention") console.log(`[🤠] 🔴`, DB.plugins_byNodeKey.get(nodeName));
|
|
4771
|
-
out += ` | ${JSON.stringify(nodeName)}\n`;
|
|
4772
|
-
}
|
|
4925
|
+
for (const nodeName of sortedNodeKeys) out += ` | ${JSON.stringify(nodeName)}\n`;
|
|
4773
4926
|
out += "\n";
|
|
4774
4927
|
const outPath = "src/manager/generated/KnownComfyCustomNodeName.ts";
|
|
4775
4928
|
(0, node_fs.writeFileSync)(outPath, out + "\n", "utf-8");
|
|
4776
4929
|
console.log(` > generated: ${ansi.blue.underline(outPath)}`);
|
|
4777
4930
|
}
|
|
4778
|
-
if (DB.opts.check)
|
|
4931
|
+
if (DB.opts.check) {
|
|
4932
|
+
console.log(` - ${totalCustomNodeSeen} CustomNodes names processed`);
|
|
4933
|
+
console.log(` - ${DB.plugins_byNodeKey.size} unique node keys registered in map`);
|
|
4934
|
+
}
|
|
4779
4935
|
};
|
|
4780
|
-
function reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(plugin
|
|
4936
|
+
function reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(plugin) {
|
|
4781
4937
|
if (plugin.id === "nodes" && plugin.reference === "https://github.com/comfyanonymous/ComfyUI") return "nodes";
|
|
4782
4938
|
const repoName = plugin.reference.match(githubRegexpV2)?.[2];
|
|
4783
4939
|
if (repoName) return `custom_nodes.${repoName}`;
|
|
4784
|
-
|
|
4785
|
-
return "🔴";
|
|
4940
|
+
return `custom_nodes.${plugin.id}`;
|
|
4786
4941
|
}
|
|
4787
4942
|
//#endregion
|
|
4788
4943
|
//#region src/manager/json/model-list.extra.ts
|
|
@@ -4806,6 +4961,9 @@ const extraModels = { models: [{
|
|
|
4806
4961
|
url: "https://huggingface.co/gemasai/4x_NMKD-Siax_200k/resolve/main/4xRealWebPhoto_v4_dat2.pth"
|
|
4807
4962
|
}] };
|
|
4808
4963
|
//#endregion
|
|
4964
|
+
//#region src/manager/types/ComfyManagerFileModelInfo.ts
|
|
4965
|
+
const ComfyManagerFileModelInfoRoot_ark = (0, arktype.type)({ models: "unknown[]" });
|
|
4966
|
+
//#endregion
|
|
4809
4967
|
//#region src/manager/types/ComfyManagerModelInfo.ts
|
|
4810
4968
|
const ComfyManagerModelInfo_ark = (0, arktype.type)({
|
|
4811
4969
|
name: arktype.type.string.as(),
|
|
@@ -4821,20 +4979,21 @@ const ComfyManagerModelInfo_ark = (0, arktype.type)({
|
|
|
4821
4979
|
//#endregion
|
|
4822
4980
|
//#region src/manager/loaders/step4_model-list-loader.ts
|
|
4823
4981
|
const _getKnownModels = (DB) => {
|
|
4824
|
-
const
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
printArkResultInConsole(errors);
|
|
4834
|
-
hasErrors = true;
|
|
4835
|
-
}
|
|
4982
|
+
const counter = DB.report.file("model-list.json");
|
|
4983
|
+
const root = ComfyManagerFileModelInfoRoot_ark(JSON.parse((0, node_fs.readFileSync)("src/manager/json/model-list.json", "utf8")));
|
|
4984
|
+
if (root instanceof arktype.type.errors) throw new ManagerParseError("model-list.json", root.summary);
|
|
4985
|
+
const canonical = [];
|
|
4986
|
+
for (const row of root.models) {
|
|
4987
|
+
const res = ComfyManagerModelInfo_ark(row);
|
|
4988
|
+
if (res instanceof arktype.type.errors) {
|
|
4989
|
+
counter.skip("schema", res.summary);
|
|
4990
|
+
continue;
|
|
4836
4991
|
}
|
|
4992
|
+
canonical.push(res);
|
|
4993
|
+
counter.ok();
|
|
4837
4994
|
}
|
|
4995
|
+
const knownModelList = canonical.concat(extraModels.models);
|
|
4996
|
+
for (const modelInfo of knownModelList) DB.knownModels.set(modelInfo.name, modelInfo);
|
|
4838
4997
|
if (DB.opts.genTypes) {
|
|
4839
4998
|
let out1 = "";
|
|
4840
4999
|
const uniqCategories = knownModelList.reduce((acc, cur) => {
|
|
@@ -4850,7 +5009,7 @@ const _getKnownModels = (DB) => {
|
|
|
4850
5009
|
for (const [cat, count] of Object.entries(uniqCategories)) out1 += ` ${JSON.stringify(cat).padEnd(20)}, // x ${count.toString().padStart(3)}\n`;
|
|
4851
5010
|
out1 += "]\n";
|
|
4852
5011
|
const out1Path = "src/manager/generated/KnownModel_Type.ts";
|
|
4853
|
-
(0,
|
|
5012
|
+
(0, node_fs.writeFileSync)(out1Path, out1 + "\n", "utf-8");
|
|
4854
5013
|
console.log(` > generated: ${ansi.blue.underline(out1Path)}`);
|
|
4855
5014
|
let out4 = "";
|
|
4856
5015
|
const uniqSavePath = knownModelList.reduce((acc, cur) => {
|
|
@@ -4866,7 +5025,7 @@ const _getKnownModels = (DB) => {
|
|
|
4866
5025
|
for (const [cat, count] of Object.entries(uniqSavePath)) out4 += ` ${JSON.stringify(cat).padEnd(50)}, // x ${count.toString().padStart(3)}\n`;
|
|
4867
5026
|
out4 += "]\n";
|
|
4868
5027
|
const out4Path = "src/manager/generated/KnownModel_SavePath.ts";
|
|
4869
|
-
(0,
|
|
5028
|
+
(0, node_fs.writeFileSync)(out4Path, out4 + "\n", "utf-8");
|
|
4870
5029
|
console.log(` > generated: ${ansi.blue.underline(out4Path)}`);
|
|
4871
5030
|
let out2 = "";
|
|
4872
5031
|
const uniqBases = knownModelList.reduce((acc, cur) => {
|
|
@@ -4883,7 +5042,7 @@ const _getKnownModels = (DB) => {
|
|
|
4883
5042
|
for (const [cat, count] of Object.entries(uniqBases)) out2 += ` ${JSON.stringify(cat).padEnd(20)}, // x ${count.toString().padStart(3)}\n`;
|
|
4884
5043
|
out2 += "]\n";
|
|
4885
5044
|
const out2Path = "src/manager/generated/KnownModel_Base.ts";
|
|
4886
|
-
(0,
|
|
5045
|
+
(0, node_fs.writeFileSync)(out2Path, out2 + "\n", "utf-8");
|
|
4887
5046
|
console.log(` > generated: ${ansi.blue.underline(out2Path)}`);
|
|
4888
5047
|
let out3 = "";
|
|
4889
5048
|
const sortedModels = knownModelList.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
|
@@ -4898,7 +5057,7 @@ const _getKnownModels = (DB) => {
|
|
|
4898
5057
|
}
|
|
4899
5058
|
out3 += "\n";
|
|
4900
5059
|
const out3Path = "src/manager/generated/KnownModel_Name.ts";
|
|
4901
|
-
(0,
|
|
5060
|
+
(0, node_fs.writeFileSync)(out3Path, out3 + "\n", "utf-8");
|
|
4902
5061
|
console.log(` > generated: ${ansi.blue.underline(out3Path)}`);
|
|
4903
5062
|
let out99 = "";
|
|
4904
5063
|
out99 += `// prettier-ignore\n`;
|
|
@@ -4912,20 +5071,78 @@ const _getKnownModels = (DB) => {
|
|
|
4912
5071
|
}
|
|
4913
5072
|
out99 += "\n";
|
|
4914
5073
|
const out99Path = "src/manager/generated/KnownModel_FileName.ts";
|
|
4915
|
-
(0,
|
|
5074
|
+
(0, node_fs.writeFileSync)(out99Path, out99 + "\n", "utf-8");
|
|
4916
5075
|
console.log(` > generated: ${ansi.blue.underline(out99Path)}`);
|
|
4917
5076
|
}
|
|
4918
5077
|
if (DB.opts.check) {
|
|
4919
5078
|
console.log(`${knownModelList.length} models found`);
|
|
4920
5079
|
console.log(`${DB.knownModels.size} models registered map`);
|
|
4921
5080
|
if (knownModelList.length !== DB.knownModels.size) console.log(`❌ some models are either duplicated or have overlapping indexing keys`);
|
|
4922
|
-
|
|
4923
|
-
|
|
5081
|
+
}
|
|
5082
|
+
};
|
|
5083
|
+
//#endregion
|
|
5084
|
+
//#region src/manager/types/ComfyManagerAlterInfo.ts
|
|
5085
|
+
const ComfyManagerAlterInfo_ark = (0, arktype.type)({
|
|
5086
|
+
id: "string",
|
|
5087
|
+
tags: "string",
|
|
5088
|
+
description: "string"
|
|
5089
|
+
});
|
|
5090
|
+
const ComfyManagerFileAlterListRoot_ark = (0, arktype.type)({ items: "unknown[]" });
|
|
5091
|
+
//#endregion
|
|
5092
|
+
//#region src/manager/loaders/step5_alter-list-loader.ts
|
|
5093
|
+
const _getAlterList = (DB) => {
|
|
5094
|
+
const counter = DB.report.file("alter-list.json");
|
|
5095
|
+
const root = ComfyManagerFileAlterListRoot_ark(JSON.parse((0, node_fs.readFileSync)("src/manager/json/alter-list.json", "utf8")));
|
|
5096
|
+
if (root instanceof arktype.type.errors) throw new ManagerParseError("alter-list.json", root.summary);
|
|
5097
|
+
const canonical = [];
|
|
5098
|
+
for (const row of root.items) {
|
|
5099
|
+
const res = ComfyManagerAlterInfo_ark(row);
|
|
5100
|
+
if (res instanceof arktype.type.errors) {
|
|
5101
|
+
counter.skip("schema", res.summary);
|
|
5102
|
+
continue;
|
|
5103
|
+
}
|
|
5104
|
+
canonical.push(res);
|
|
5105
|
+
counter.ok();
|
|
5106
|
+
}
|
|
5107
|
+
DB.alterations = canonical;
|
|
5108
|
+
};
|
|
5109
|
+
//#endregion
|
|
5110
|
+
//#region src/manager/types/ComfyManagerGithubStats.ts
|
|
5111
|
+
const ComfyManagerGithubStatEntry_ark = (0, arktype.type)({
|
|
5112
|
+
stars: "number",
|
|
5113
|
+
last_update: "string",
|
|
5114
|
+
author_account_age_days: "number"
|
|
5115
|
+
});
|
|
5116
|
+
//#endregion
|
|
5117
|
+
//#region src/manager/loaders/step6_github-stats-loader.ts
|
|
5118
|
+
const _getGithubStats = (DB) => {
|
|
5119
|
+
const counter = DB.report.file("github-stats.json");
|
|
5120
|
+
const raw = JSON.parse((0, node_fs.readFileSync)("src/manager/json/github-stats.json", "utf8"));
|
|
5121
|
+
const root = (0, arktype.type)("Record<string, unknown>")(raw);
|
|
5122
|
+
if (root instanceof arktype.type.errors) throw new ManagerParseError("github-stats.json", root.summary);
|
|
5123
|
+
for (const [url, value] of Object.entries(root)) {
|
|
5124
|
+
const res = ComfyManagerGithubStatEntry_ark(value);
|
|
5125
|
+
if (res instanceof arktype.type.errors) {
|
|
5126
|
+
counter.skip("schema", `${url}: ${res.summary}`);
|
|
5127
|
+
continue;
|
|
5128
|
+
}
|
|
5129
|
+
DB.githubStats.set(url, res);
|
|
5130
|
+
counter.ok();
|
|
4924
5131
|
}
|
|
4925
5132
|
};
|
|
4926
5133
|
//#endregion
|
|
4927
5134
|
//#region src/manager/ComfyRegistry.ts
|
|
4928
5135
|
const log = (...args) => console.log(`[📘 registry]`, ...args);
|
|
5136
|
+
const BUILTIN_URL = "https://github.com/comfyanonymous/ComfyUI";
|
|
5137
|
+
const BUILTIN_PLUGIN = {
|
|
5138
|
+
id: "nodes",
|
|
5139
|
+
author: "comfyanonymous",
|
|
5140
|
+
description: "built-in",
|
|
5141
|
+
title: "built-in",
|
|
5142
|
+
files: [BUILTIN_URL],
|
|
5143
|
+
reference: "https://github.com/comfyanonymous/ComfyUI",
|
|
5144
|
+
install_type: ""
|
|
5145
|
+
};
|
|
4929
5146
|
var ComfyRegistry = class ComfyRegistry {
|
|
4930
5147
|
static async DownloadAndUpdate(download) {
|
|
4931
5148
|
if (download) {
|
|
@@ -4945,6 +5162,9 @@ var ComfyRegistry = class ComfyRegistry {
|
|
|
4945
5162
|
this.plugins_byNodeKey = /* @__PURE__ */ new Map();
|
|
4946
5163
|
this.customNodes_byPluginName = /* @__PURE__ */ new Map();
|
|
4947
5164
|
this.knownModels = /* @__PURE__ */ new Map();
|
|
5165
|
+
this.alterations = [];
|
|
5166
|
+
this.githubStats = /* @__PURE__ */ new Map();
|
|
5167
|
+
this.report = new ManagerParseReport();
|
|
4948
5168
|
this.getKnownCheckpoints = () => {
|
|
4949
5169
|
return [...this.knownModels.values()].filter((i) => i.type === "checkpoint");
|
|
4950
5170
|
};
|
|
@@ -4984,25 +5204,28 @@ var ComfyRegistry = class ComfyRegistry {
|
|
|
4984
5204
|
nix: isUnderPrefix ? nixPath.slice(nixPrefix.length) : mi.filename
|
|
4985
5205
|
};
|
|
4986
5206
|
};
|
|
4987
|
-
this.
|
|
4988
|
-
|
|
4989
|
-
author: "comfyanonymous",
|
|
4990
|
-
description: "built-in",
|
|
4991
|
-
title: "built-in",
|
|
4992
|
-
files: [],
|
|
4993
|
-
reference: "https://github.com/comfyanonymous/ComfyUI",
|
|
4994
|
-
install_type: ""
|
|
4995
|
-
});
|
|
5207
|
+
this.plugins_byTitle.set(BUILTIN_PLUGIN.title, BUILTIN_PLUGIN);
|
|
5208
|
+
this.plugins_byFile.set(BUILTIN_URL, BUILTIN_PLUGIN);
|
|
4996
5209
|
log(`loading src/manager/json/${ansi.yellow("custom-node-list.json")}...`);
|
|
4997
5210
|
_getKnownPlugins(this);
|
|
4998
5211
|
log(`loading src/manager/json/${ansi.yellow("extension-node-map.json")}...`);
|
|
4999
5212
|
_getCustomNodeRegistry(this);
|
|
5000
5213
|
log(`loading src/manager/json/${ansi.yellow("model-list.json")}...`);
|
|
5001
5214
|
_getKnownModels(this);
|
|
5215
|
+
log(`loading src/manager/json/${ansi.yellow("alter-list.json")}...`);
|
|
5216
|
+
_getAlterList(this);
|
|
5217
|
+
log(`loading src/manager/json/${ansi.yellow("github-stats.json")}...`);
|
|
5218
|
+
_getGithubStats(this);
|
|
5219
|
+
this.report.print();
|
|
5002
5220
|
}
|
|
5003
5221
|
};
|
|
5004
5222
|
//#endregion
|
|
5005
5223
|
//#region src/state.ts
|
|
5224
|
+
/** the ONE settings-file location rule — run-tui reads it BEFORE any module
|
|
5225
|
+
* import creates the comfyts global, so the path logic cannot live on the instance only */
|
|
5226
|
+
function settingsPathFor(root) {
|
|
5227
|
+
return asAbsolutePath((0, pathe.join)(root, ".comfy-ts", "settings.json"));
|
|
5228
|
+
}
|
|
5006
5229
|
/** singleton */
|
|
5007
5230
|
var ComfyTS = class ComfyTS {
|
|
5008
5231
|
constructor(p = {}) {
|
|
@@ -5071,7 +5294,7 @@ var ComfyTS = class ComfyTS {
|
|
|
5071
5294
|
}
|
|
5072
5295
|
/** local TUI settings (preview mode, last draft per workflow) — gitignored */
|
|
5073
5296
|
get settingsPath() {
|
|
5074
|
-
return
|
|
5297
|
+
return settingsPathFor(this.rootPath);
|
|
5075
5298
|
}
|
|
5076
5299
|
resolveFromHosts(relativePath) {
|
|
5077
5300
|
return asAbsolutePath((0, pathe.join)(this.hostsFolder, relativePath));
|
|
@@ -5090,6 +5313,52 @@ var ComfyTS = class ComfyTS {
|
|
|
5090
5313
|
}
|
|
5091
5314
|
};
|
|
5092
5315
|
//#endregion
|
|
5316
|
+
//#region src/exampleAssets.ts
|
|
5317
|
+
/**
|
|
5318
|
+
* the examples/ folder shipped in the npm tarball, resolved from THIS module's
|
|
5319
|
+
* own location (NEVER cwd): walking up to the nearest NAMED package.json finds
|
|
5320
|
+
* <pkg>/examples both from a consumer's node_modules/comfy-ts/dist/ and from
|
|
5321
|
+
* this repo's src/. Returns null when the examples are absent (a consumer may
|
|
5322
|
+
* prune the folder) or when the nearest named package is not comfy-ts (the lib
|
|
5323
|
+
* was inlined into someone else's bundle — its examples are not on disk); no
|
|
5324
|
+
* package.json all the way up is a broken install and throws.
|
|
5325
|
+
*/
|
|
5326
|
+
function bundledExamplesDir(moduleUrl = require("url").pathToFileURL(__filename).href) {
|
|
5327
|
+
let dir = (0, pathe.dirname)((0, node_url.fileURLToPath)(moduleUrl));
|
|
5328
|
+
let prev = "";
|
|
5329
|
+
while (dir !== prev) {
|
|
5330
|
+
const pkgPath = (0, pathe.join)(dir, "package.json");
|
|
5331
|
+
if ((0, node_fs.existsSync)(pkgPath)) {
|
|
5332
|
+
let pkg = {};
|
|
5333
|
+
try {
|
|
5334
|
+
pkg = JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf8"));
|
|
5335
|
+
} catch {}
|
|
5336
|
+
if (pkg.name === "comfy-ts") {
|
|
5337
|
+
const examples = (0, pathe.join)(dir, "examples");
|
|
5338
|
+
return (0, node_fs.existsSync)(examples) ? examples : null;
|
|
5339
|
+
}
|
|
5340
|
+
if (pkg.name != null) return null;
|
|
5341
|
+
}
|
|
5342
|
+
prev = dir;
|
|
5343
|
+
dir = (0, pathe.dirname)(dir);
|
|
5344
|
+
}
|
|
5345
|
+
throw new Error(`[comfy-ts] no package.json found walking up from ${(0, node_url.fileURLToPath)(moduleUrl)}`);
|
|
5346
|
+
}
|
|
5347
|
+
/**
|
|
5348
|
+
* absolute path of a bundled `examples/images/` input image, e.g.
|
|
5349
|
+
* `exampleImagePath('bear_1024x1024.jpg')` — the out-of-the-box default for
|
|
5350
|
+
* i2i/i2v example image vars, valid from this repo AND from a consumer's
|
|
5351
|
+
* node_modules/comfy-ts/. Loud throw naming the path when the file is missing
|
|
5352
|
+
* or the package's examples/ folder was pruned.
|
|
5353
|
+
*/
|
|
5354
|
+
function exampleImagePath(name) {
|
|
5355
|
+
const examples = bundledExamplesDir();
|
|
5356
|
+
if (examples == null) throw new Error(`[comfy-ts] cannot resolve bundled example image '${name}': the package's examples/ folder is not on disk`);
|
|
5357
|
+
const abs = (0, pathe.join)(examples, "images", name);
|
|
5358
|
+
if (!(0, node_fs.existsSync)(abs)) throw new Error(`[comfy-ts] bundled example image not found: ${abs}`);
|
|
5359
|
+
return abs;
|
|
5360
|
+
}
|
|
5361
|
+
//#endregion
|
|
5093
5362
|
//#region src/cli/tui-env.ts
|
|
5094
5363
|
const COMFY_TS_TUI_ENV = "COMFY_TS_TUI";
|
|
5095
5364
|
function isTuiActive() {
|
|
@@ -5122,9 +5391,12 @@ exports.ComfyVar = ComfyVar;
|
|
|
5122
5391
|
exports.ComfyVarBase = ComfyVarBase;
|
|
5123
5392
|
exports.ComfyWorkflow = ComfyWorkflow;
|
|
5124
5393
|
exports.ComfyWorkflowBuilder = ComfyWorkflowBuilder;
|
|
5394
|
+
exports.DEFAULT_IMAGE_EXTENSIONS = DEFAULT_IMAGE_EXTENSIONS;
|
|
5125
5395
|
exports.DEFAULT_SIZE_PRESETS = DEFAULT_SIZE_PRESETS;
|
|
5126
5396
|
exports.DefinedWorkflow = DefinedWorkflow;
|
|
5127
5397
|
exports.FloatVar = FloatVar;
|
|
5398
|
+
exports.ImageVar = ImageVar;
|
|
5399
|
+
exports.ImageVarEmptyError = ImageVarEmptyError;
|
|
5128
5400
|
exports.IntVar = IntVar;
|
|
5129
5401
|
exports.InvalidPromptError = InvalidPromptError;
|
|
5130
5402
|
exports.LorasVar = LorasVar;
|
|
@@ -5149,6 +5421,7 @@ exports.auto_ = auto_;
|
|
|
5149
5421
|
exports.codegenSDK = codegenSDK;
|
|
5150
5422
|
exports.convertFlowToLiteGraphJSON = convertFlowToLiteGraphJSON;
|
|
5151
5423
|
exports.convertLiteGraphToPrompt = convertLiteGraphToPrompt;
|
|
5424
|
+
exports.exampleImagePath = exampleImagePath;
|
|
5152
5425
|
exports.getLoraKeyword = getLoraKeyword;
|
|
5153
5426
|
exports.hostIdToNamespace = hostIdToNamespace;
|
|
5154
5427
|
exports.isTuiActive = isTuiActive;
|