comfy-ts 1.1.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 +21 -8
- package/dist/cli.js +4 -4552
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +53 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -23
- package/dist/index.d.ts +49 -23
- package/dist/index.js +53 -12
- package/dist/index.js.map +1 -1
- package/dist/{run-tui-DZ22HDHI.js → run-tui-BAdizWsO.js} +722 -130
- 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 +6 -4
- 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} +1 -1
- 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/{05-comfy-cloud.cflow.ts → rvion/05-comfy-cloud.cflow.ts} +2 -2
- package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
- package/package.json +4 -1
- 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/StatusBar.tsx +28 -9
- package/src/cli/tui/components/TreePanel.tsx +17 -7
- package/src/cli/tui/components/TuiApp.tsx +47 -5
- package/src/cli/tui/imagePicker/fsListing.ts +6 -4
- package/src/cli/tui/run-tui.tsx +47 -7
- 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/PickerSt.ts +8 -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 +47 -6
- package/src/cli/tui/state/WorkflowsSt.ts +14 -2
- package/src/cli/tui/treeRows.ts +165 -0
- package/src/host/ComfyHost.ts +7 -0
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +25 -4
- package/src/vars/DefinedWorkflow.ts +21 -8
- package/dist/DefinedWorkflow-BYyu5dK9.js +0 -669
- package/dist/DefinedWorkflow-BYyu5dK9.js.map +0 -1
- package/dist/run-tui-DZ22HDHI.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -11897,16 +11897,9 @@ declare const types$1: import("arktype").Module<{
|
|
|
11897
11897
|
};
|
|
11898
11898
|
PromptID: PromptID;
|
|
11899
11899
|
PromptRelated_WsMsg: {
|
|
11900
|
-
type: "
|
|
11901
|
-
data: {
|
|
11902
|
-
value: number;
|
|
11903
|
-
max: number;
|
|
11904
|
-
};
|
|
11905
|
-
} | {
|
|
11906
|
-
type: "executing";
|
|
11900
|
+
type: "execution_start";
|
|
11907
11901
|
data: {
|
|
11908
11902
|
prompt_id: PromptID;
|
|
11909
|
-
node?: ComfyNodeId | null | undefined;
|
|
11910
11903
|
};
|
|
11911
11904
|
} | {
|
|
11912
11905
|
type: "execution_cached";
|
|
@@ -11915,9 +11908,16 @@ declare const types$1: import("arktype").Module<{
|
|
|
11915
11908
|
prompt_id: PromptID;
|
|
11916
11909
|
};
|
|
11917
11910
|
} | {
|
|
11918
|
-
type: "
|
|
11911
|
+
type: "executing";
|
|
11919
11912
|
data: {
|
|
11920
11913
|
prompt_id: PromptID;
|
|
11914
|
+
node?: ComfyNodeId | null | undefined;
|
|
11915
|
+
};
|
|
11916
|
+
} | {
|
|
11917
|
+
type: "progress";
|
|
11918
|
+
data: {
|
|
11919
|
+
value: number;
|
|
11920
|
+
max: number;
|
|
11921
11921
|
};
|
|
11922
11922
|
} | {
|
|
11923
11923
|
type: "progress_state";
|
|
@@ -11972,16 +11972,9 @@ declare const types$1: import("arktype").Module<{
|
|
|
11972
11972
|
data: string;
|
|
11973
11973
|
};
|
|
11974
11974
|
WsMsg: {
|
|
11975
|
-
type: "
|
|
11976
|
-
data: {
|
|
11977
|
-
value: number;
|
|
11978
|
-
max: number;
|
|
11979
|
-
};
|
|
11980
|
-
} | {
|
|
11981
|
-
type: "executing";
|
|
11975
|
+
type: "execution_start";
|
|
11982
11976
|
data: {
|
|
11983
11977
|
prompt_id: PromptID;
|
|
11984
|
-
node?: ComfyNodeId | null | undefined;
|
|
11985
11978
|
};
|
|
11986
11979
|
} | {
|
|
11987
11980
|
type: "execution_cached";
|
|
@@ -11990,9 +11983,16 @@ declare const types$1: import("arktype").Module<{
|
|
|
11990
11983
|
prompt_id: PromptID;
|
|
11991
11984
|
};
|
|
11992
11985
|
} | {
|
|
11993
|
-
type: "
|
|
11986
|
+
type: "executing";
|
|
11994
11987
|
data: {
|
|
11995
11988
|
prompt_id: PromptID;
|
|
11989
|
+
node?: ComfyNodeId | null | undefined;
|
|
11990
|
+
};
|
|
11991
|
+
} | {
|
|
11992
|
+
type: "progress";
|
|
11993
|
+
data: {
|
|
11994
|
+
value: number;
|
|
11995
|
+
max: number;
|
|
11996
11996
|
};
|
|
11997
11997
|
} | {
|
|
11998
11998
|
type: "progress_state";
|
|
@@ -16057,11 +16057,22 @@ type SizePreset = {
|
|
|
16057
16057
|
};
|
|
16058
16058
|
/** SDXL-style ~1MP buckets, multiples of 64 — safe for most latent models */
|
|
16059
16059
|
declare const DEFAULT_SIZE_PRESETS: SizePreset[];
|
|
16060
|
-
/** width/height picker: presets + free `WxH` entry
|
|
16060
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
16061
|
+
* size of a linked image var (his ask 2026-07-30: the widget shows
|
|
16062
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
16061
16063
|
declare class SizeVar extends ComfyVar<SizeValue> {
|
|
16062
16064
|
readonly presets: SizePreset[];
|
|
16065
|
+
readonly imageVar?: ImageVar | undefined;
|
|
16063
16066
|
readonly kind: 'size';
|
|
16064
|
-
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string);
|
|
16067
|
+
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string, imageVar?: ImageVar | undefined);
|
|
16068
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
16069
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
16070
|
+
* image var itself, the size row simply disappears) */
|
|
16071
|
+
imageSize(): {
|
|
16072
|
+
width: number;
|
|
16073
|
+
height: number;
|
|
16074
|
+
name: string;
|
|
16075
|
+
} | null;
|
|
16065
16076
|
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
16066
16077
|
parse(raw: string): boolean;
|
|
16067
16078
|
display(): string;
|
|
@@ -16126,6 +16137,7 @@ declare const v: {
|
|
|
16126
16137
|
size: (defaultValue?: SizeValue, opts?: {
|
|
16127
16138
|
presets?: SizePreset[];
|
|
16128
16139
|
label?: string;
|
|
16140
|
+
image?: ImageVar;
|
|
16129
16141
|
}) => SizeVar;
|
|
16130
16142
|
image: (defaultValue: string, opts?: ImageVarOpts) => ImageVar;
|
|
16131
16143
|
};
|
|
@@ -16171,6 +16183,9 @@ type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
|
16171
16183
|
type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
16172
16184
|
/** short id; also names the workflow instances */
|
|
16173
16185
|
id?: string;
|
|
16186
|
+
/** optional TUI tree color (ink color name or hex); unset = the tree's
|
|
16187
|
+
* per-family palette (first `-` word of the module basename) */
|
|
16188
|
+
color?: string;
|
|
16174
16189
|
/** the tweakable knobs; drivers (scripts, TUI) edit these between runs.
|
|
16175
16190
|
* A LAMBDA gives cross-referencing vars a scope (loras + prompt with
|
|
16176
16191
|
* loraKeywordsFrom created inline) — resolved ONCE at define time, and it
|
|
@@ -16201,14 +16216,20 @@ declare class DefinedWorkflow<ID extends string = string, V extends VarsSpec = V
|
|
|
16201
16216
|
* (set by run()) fires each var's afterRun() right after snapshotting the
|
|
16202
16217
|
* values — atomically, before any await — so the graph uses this run's seed
|
|
16203
16218
|
* while the var moves to the next (queued runs get distinct seeds; a bare
|
|
16204
|
-
* build() for copy/export never advances).
|
|
16219
|
+
* build() for copy/export never advances). `p.host` substitutes the host
|
|
16220
|
+
* the graph is built against (TUI host override): node/model availability
|
|
16221
|
+
* there surfaces as workflow.problems / server validation, by design.
|
|
16205
16222
|
*/
|
|
16206
16223
|
build(p?: {
|
|
16207
16224
|
advance?: boolean;
|
|
16225
|
+
host?: ComfyHost<ID>;
|
|
16208
16226
|
}): Promise<ComfyWorkflow<ID>>;
|
|
16209
16227
|
/** build a fresh graph from the current var values, send it, wait for outputs.
|
|
16210
|
-
* connects first (idempotent) — modules can import offline from the schema cache
|
|
16211
|
-
|
|
16228
|
+
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
16229
|
+
* `settings.host` runs against THAT host instead of the defining one. */
|
|
16230
|
+
run(settings?: RunSettings & {
|
|
16231
|
+
host?: ComfyHost<ID>;
|
|
16232
|
+
}): Promise<ComfyExecution>;
|
|
16212
16233
|
}
|
|
16213
16234
|
//#endregion
|
|
16214
16235
|
//#region src/host/ComfyHost.d.ts
|
|
@@ -16511,6 +16532,11 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16511
16532
|
private _unknownBinaryFrameTypes;
|
|
16512
16533
|
/** handy to keep around */
|
|
16513
16534
|
status: ComfyStatusData['status'] | null;
|
|
16535
|
+
/** last time ANY ws message arrived — proof-of-life for the TUI probe: a
|
|
16536
|
+
* busy single-threaded ComfyUI stalls NEW connects while established
|
|
16537
|
+
* sockets keep streaming (a half-open socket receives nothing, so this
|
|
16538
|
+
* never revives one) */
|
|
16539
|
+
lastWsMessageAt: number | null;
|
|
16514
16540
|
onMessage(e: MessageEvent): void;
|
|
16515
16541
|
}
|
|
16516
16542
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -11897,27 +11897,27 @@ declare const types$1: import("arktype").Module<{
|
|
|
11897
11897
|
};
|
|
11898
11898
|
PromptID: PromptID;
|
|
11899
11899
|
PromptRelated_WsMsg: {
|
|
11900
|
-
type: "
|
|
11900
|
+
type: "progress";
|
|
11901
11901
|
data: {
|
|
11902
|
-
|
|
11902
|
+
value: number;
|
|
11903
|
+
max: number;
|
|
11903
11904
|
};
|
|
11904
11905
|
} | {
|
|
11905
|
-
type: "
|
|
11906
|
+
type: "executing";
|
|
11906
11907
|
data: {
|
|
11907
|
-
nodes: ComfyNodeId[];
|
|
11908
11908
|
prompt_id: PromptID;
|
|
11909
|
+
node?: ComfyNodeId | null | undefined;
|
|
11909
11910
|
};
|
|
11910
11911
|
} | {
|
|
11911
|
-
type: "
|
|
11912
|
+
type: "execution_cached";
|
|
11912
11913
|
data: {
|
|
11914
|
+
nodes: ComfyNodeId[];
|
|
11913
11915
|
prompt_id: PromptID;
|
|
11914
|
-
node?: ComfyNodeId | null | undefined;
|
|
11915
11916
|
};
|
|
11916
11917
|
} | {
|
|
11917
|
-
type: "
|
|
11918
|
+
type: "execution_start";
|
|
11918
11919
|
data: {
|
|
11919
|
-
|
|
11920
|
-
max: number;
|
|
11920
|
+
prompt_id: PromptID;
|
|
11921
11921
|
};
|
|
11922
11922
|
} | {
|
|
11923
11923
|
type: "progress_state";
|
|
@@ -11972,27 +11972,27 @@ declare const types$1: import("arktype").Module<{
|
|
|
11972
11972
|
data: string;
|
|
11973
11973
|
};
|
|
11974
11974
|
WsMsg: {
|
|
11975
|
-
type: "
|
|
11975
|
+
type: "progress";
|
|
11976
11976
|
data: {
|
|
11977
|
-
|
|
11977
|
+
value: number;
|
|
11978
|
+
max: number;
|
|
11978
11979
|
};
|
|
11979
11980
|
} | {
|
|
11980
|
-
type: "
|
|
11981
|
+
type: "executing";
|
|
11981
11982
|
data: {
|
|
11982
|
-
nodes: ComfyNodeId[];
|
|
11983
11983
|
prompt_id: PromptID;
|
|
11984
|
+
node?: ComfyNodeId | null | undefined;
|
|
11984
11985
|
};
|
|
11985
11986
|
} | {
|
|
11986
|
-
type: "
|
|
11987
|
+
type: "execution_cached";
|
|
11987
11988
|
data: {
|
|
11989
|
+
nodes: ComfyNodeId[];
|
|
11988
11990
|
prompt_id: PromptID;
|
|
11989
|
-
node?: ComfyNodeId | null | undefined;
|
|
11990
11991
|
};
|
|
11991
11992
|
} | {
|
|
11992
|
-
type: "
|
|
11993
|
+
type: "execution_start";
|
|
11993
11994
|
data: {
|
|
11994
|
-
|
|
11995
|
-
max: number;
|
|
11995
|
+
prompt_id: PromptID;
|
|
11996
11996
|
};
|
|
11997
11997
|
} | {
|
|
11998
11998
|
type: "progress_state";
|
|
@@ -16057,11 +16057,22 @@ type SizePreset = {
|
|
|
16057
16057
|
};
|
|
16058
16058
|
/** SDXL-style ~1MP buckets, multiples of 64 — safe for most latent models */
|
|
16059
16059
|
declare const DEFAULT_SIZE_PRESETS: SizePreset[];
|
|
16060
|
-
/** width/height picker: presets + free `WxH` entry
|
|
16060
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
16061
|
+
* size of a linked image var (his ask 2026-07-30: the widget shows
|
|
16062
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
16061
16063
|
declare class SizeVar extends ComfyVar<SizeValue> {
|
|
16062
16064
|
readonly presets: SizePreset[];
|
|
16065
|
+
readonly imageVar?: ImageVar | undefined;
|
|
16063
16066
|
readonly kind: 'size';
|
|
16064
|
-
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string);
|
|
16067
|
+
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string, imageVar?: ImageVar | undefined);
|
|
16068
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
16069
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
16070
|
+
* image var itself, the size row simply disappears) */
|
|
16071
|
+
imageSize(): {
|
|
16072
|
+
width: number;
|
|
16073
|
+
height: number;
|
|
16074
|
+
name: string;
|
|
16075
|
+
} | null;
|
|
16065
16076
|
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
16066
16077
|
parse(raw: string): boolean;
|
|
16067
16078
|
display(): string;
|
|
@@ -16126,6 +16137,7 @@ declare const v: {
|
|
|
16126
16137
|
size: (defaultValue?: SizeValue, opts?: {
|
|
16127
16138
|
presets?: SizePreset[];
|
|
16128
16139
|
label?: string;
|
|
16140
|
+
image?: ImageVar;
|
|
16129
16141
|
}) => SizeVar;
|
|
16130
16142
|
image: (defaultValue: string, opts?: ImageVarOpts) => ImageVar;
|
|
16131
16143
|
};
|
|
@@ -16171,6 +16183,9 @@ type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
|
16171
16183
|
type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
16172
16184
|
/** short id; also names the workflow instances */
|
|
16173
16185
|
id?: string;
|
|
16186
|
+
/** optional TUI tree color (ink color name or hex); unset = the tree's
|
|
16187
|
+
* per-family palette (first `-` word of the module basename) */
|
|
16188
|
+
color?: string;
|
|
16174
16189
|
/** the tweakable knobs; drivers (scripts, TUI) edit these between runs.
|
|
16175
16190
|
* A LAMBDA gives cross-referencing vars a scope (loras + prompt with
|
|
16176
16191
|
* loraKeywordsFrom created inline) — resolved ONCE at define time, and it
|
|
@@ -16201,14 +16216,20 @@ declare class DefinedWorkflow<ID extends string = string, V extends VarsSpec = V
|
|
|
16201
16216
|
* (set by run()) fires each var's afterRun() right after snapshotting the
|
|
16202
16217
|
* values — atomically, before any await — so the graph uses this run's seed
|
|
16203
16218
|
* while the var moves to the next (queued runs get distinct seeds; a bare
|
|
16204
|
-
* build() for copy/export never advances).
|
|
16219
|
+
* build() for copy/export never advances). `p.host` substitutes the host
|
|
16220
|
+
* the graph is built against (TUI host override): node/model availability
|
|
16221
|
+
* there surfaces as workflow.problems / server validation, by design.
|
|
16205
16222
|
*/
|
|
16206
16223
|
build(p?: {
|
|
16207
16224
|
advance?: boolean;
|
|
16225
|
+
host?: ComfyHost<ID>;
|
|
16208
16226
|
}): Promise<ComfyWorkflow<ID>>;
|
|
16209
16227
|
/** build a fresh graph from the current var values, send it, wait for outputs.
|
|
16210
|
-
* connects first (idempotent) — modules can import offline from the schema cache
|
|
16211
|
-
|
|
16228
|
+
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
16229
|
+
* `settings.host` runs against THAT host instead of the defining one. */
|
|
16230
|
+
run(settings?: RunSettings & {
|
|
16231
|
+
host?: ComfyHost<ID>;
|
|
16232
|
+
}): Promise<ComfyExecution>;
|
|
16212
16233
|
}
|
|
16213
16234
|
//#endregion
|
|
16214
16235
|
//#region src/host/ComfyHost.d.ts
|
|
@@ -16511,6 +16532,11 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16511
16532
|
private _unknownBinaryFrameTypes;
|
|
16512
16533
|
/** handy to keep around */
|
|
16513
16534
|
status: ComfyStatusData['status'] | null;
|
|
16535
|
+
/** last time ANY ws message arrived — proof-of-life for the TUI probe: a
|
|
16536
|
+
* busy single-threaded ComfyUI stalls NEW connects while established
|
|
16537
|
+
* sockets keep streaming (a half-open socket receives nothing, so this
|
|
16538
|
+
* never revives one) */
|
|
16539
|
+
lastWsMessageAt: number | null;
|
|
16514
16540
|
onMessage(e: MessageEvent): void;
|
|
16515
16541
|
}
|
|
16516
16542
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import https from "node:https";
|
|
|
12
12
|
import { stdout } from "node:process";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
//#region package.json
|
|
15
|
-
var version = "1.
|
|
15
|
+
var version = "1.2.0";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
18
18
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -2183,8 +2183,8 @@ function comfyWorkflowAutoLayout(p) {
|
|
|
2183
2183
|
if (cols[at]) cols[at].push(node);
|
|
2184
2184
|
else cols[at] = [node];
|
|
2185
2185
|
}
|
|
2186
|
-
const HSEP = p?.node_hsep ??
|
|
2187
|
-
const VSEP = p?.node_vsep ??
|
|
2186
|
+
const HSEP = p?.node_hsep ?? 100;
|
|
2187
|
+
const VSEP = p?.node_vsep ?? 40;
|
|
2188
2188
|
let colX = 0;
|
|
2189
2189
|
let maxY = 0;
|
|
2190
2190
|
for (const col of cols) {
|
|
@@ -3915,16 +3915,38 @@ const DEFAULT_SIZE_PRESETS = [
|
|
|
3915
3915
|
height: 1344
|
|
3916
3916
|
}
|
|
3917
3917
|
];
|
|
3918
|
-
/** width/height picker: presets + free `WxH` entry
|
|
3918
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
3919
|
+
* size of a linked image var (his ask 2026-07-30: the widget shows
|
|
3920
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
3919
3921
|
var SizeVar = class extends ComfyVar {
|
|
3920
3922
|
constructor(defaultValue = {
|
|
3921
3923
|
width: 1024,
|
|
3922
3924
|
height: 1024
|
|
3923
|
-
}, presets = DEFAULT_SIZE_PRESETS, label) {
|
|
3925
|
+
}, presets = DEFAULT_SIZE_PRESETS, label, imageVar) {
|
|
3924
3926
|
super(defaultValue, label);
|
|
3925
3927
|
this.presets = presets;
|
|
3928
|
+
this.imageVar = imageVar;
|
|
3926
3929
|
this.kind = "size";
|
|
3927
3930
|
}
|
|
3931
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
3932
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
3933
|
+
* image var itself, the size row simply disappears) */
|
|
3934
|
+
imageSize() {
|
|
3935
|
+
const iv = this.imageVar;
|
|
3936
|
+
if (iv == null || iv.value === "") return null;
|
|
3937
|
+
try {
|
|
3938
|
+
const abs = iv.absPath();
|
|
3939
|
+
const meta = imageMeta(new Uint8Array(readFileSync(abs)));
|
|
3940
|
+
if (meta.width == null || meta.height == null) return null;
|
|
3941
|
+
return {
|
|
3942
|
+
width: meta.width,
|
|
3943
|
+
height: meta.height,
|
|
3944
|
+
name: basename(abs)
|
|
3945
|
+
};
|
|
3946
|
+
} catch {
|
|
3947
|
+
return null;
|
|
3948
|
+
}
|
|
3949
|
+
}
|
|
3928
3950
|
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
3929
3951
|
parse(raw) {
|
|
3930
3952
|
const m = raw.trim().match(/^(\d+)\s*[x×]\s*(\d+)$/);
|
|
@@ -4027,7 +4049,7 @@ const v = {
|
|
|
4027
4049
|
toggle: (defaultValue, label) => new ToggleVar(defaultValue, label),
|
|
4028
4050
|
choice: (choices, defaultValue, label) => new ChoiceVar(choices, defaultValue, label),
|
|
4029
4051
|
loras: (options, initial = {}, label) => new LorasVar(options, initial, label),
|
|
4030
|
-
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets, opts.label),
|
|
4052
|
+
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets, opts.label, opts.image),
|
|
4031
4053
|
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts)
|
|
4032
4054
|
};
|
|
4033
4055
|
function varValues(vars) {
|
|
@@ -4066,10 +4088,12 @@ var DefinedWorkflow = class {
|
|
|
4066
4088
|
* (set by run()) fires each var's afterRun() right after snapshotting the
|
|
4067
4089
|
* values — atomically, before any await — so the graph uses this run's seed
|
|
4068
4090
|
* while the var moves to the next (queued runs get distinct seeds; a bare
|
|
4069
|
-
* build() for copy/export never advances).
|
|
4091
|
+
* build() for copy/export never advances). `p.host` substitutes the host
|
|
4092
|
+
* the graph is built against (TUI host override): node/model availability
|
|
4093
|
+
* there surfaces as workflow.problems / server validation, by design.
|
|
4070
4094
|
*/
|
|
4071
4095
|
async build(p = {}) {
|
|
4072
|
-
const wf = this.host.workflow({ id: this.spec.id });
|
|
4096
|
+
const wf = (p.host ?? this.host).workflow({ id: this.spec.id });
|
|
4073
4097
|
const values = varValues(this.vars);
|
|
4074
4098
|
if (p.advance) for (const varDef of Object.values(this.vars)) varDef.afterRun();
|
|
4075
4099
|
await this.spec.build(wf.builder, values, wf);
|
|
@@ -4077,10 +4101,20 @@ var DefinedWorkflow = class {
|
|
|
4077
4101
|
return wf;
|
|
4078
4102
|
}
|
|
4079
4103
|
/** build a fresh graph from the current var values, send it, wait for outputs.
|
|
4080
|
-
* connects first (idempotent) — modules can import offline from the schema cache
|
|
4104
|
+
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
4105
|
+
* `settings.host` runs against THAT host instead of the defining one. */
|
|
4081
4106
|
async run(settings = {}) {
|
|
4082
|
-
|
|
4083
|
-
|
|
4107
|
+
const host = settings.host ?? this.host;
|
|
4108
|
+
await host.connect();
|
|
4109
|
+
const execution = await (await this.build({
|
|
4110
|
+
advance: true,
|
|
4111
|
+
host
|
|
4112
|
+
})).run({
|
|
4113
|
+
saveFormat: settings.saveFormat,
|
|
4114
|
+
idMode: settings.idMode,
|
|
4115
|
+
log: settings.log,
|
|
4116
|
+
onProgress: settings.onProgress
|
|
4117
|
+
});
|
|
4084
4118
|
this.lastExecution = execution;
|
|
4085
4119
|
return execution;
|
|
4086
4120
|
}
|
|
@@ -4337,6 +4371,7 @@ var ComfyHost = class {
|
|
|
4337
4371
|
this.comfySessionId = "temp";
|
|
4338
4372
|
this._unknownBinaryFrameTypes = /* @__PURE__ */ new Set();
|
|
4339
4373
|
this.status = null;
|
|
4374
|
+
this.lastWsMessageAt = null;
|
|
4340
4375
|
this.base = parseHostBase(this.data);
|
|
4341
4376
|
/** folder where file related to the host config will be cached */
|
|
4342
4377
|
this.cacheFolder = comfyts.resolveFromHosts(this.data.id);
|
|
@@ -4490,6 +4525,7 @@ var ComfyHost = class {
|
|
|
4490
4525
|
prompt.onPromptRelatedMessage(msg);
|
|
4491
4526
|
}
|
|
4492
4527
|
onMessage(e) {
|
|
4528
|
+
this.lastWsMessageAt = Date.now();
|
|
4493
4529
|
if (this.data.onWsMessageAny) this.data.onWsMessageAny(e);
|
|
4494
4530
|
if (e.data instanceof ArrayBuffer) {
|
|
4495
4531
|
const frame = parseBinaryWsFrame(e.data);
|
|
@@ -5154,6 +5190,11 @@ var ComfyRegistry = class ComfyRegistry {
|
|
|
5154
5190
|
};
|
|
5155
5191
|
//#endregion
|
|
5156
5192
|
//#region src/state.ts
|
|
5193
|
+
/** the ONE settings-file location rule — run-tui reads it BEFORE any module
|
|
5194
|
+
* import creates the comfyts global, so the path logic cannot live on the instance only */
|
|
5195
|
+
function settingsPathFor(root) {
|
|
5196
|
+
return asAbsolutePath(join(root, ".comfy-ts", "settings.json"));
|
|
5197
|
+
}
|
|
5157
5198
|
/** singleton */
|
|
5158
5199
|
var ComfyTS = class ComfyTS {
|
|
5159
5200
|
constructor(p = {}) {
|
|
@@ -5222,7 +5263,7 @@ var ComfyTS = class ComfyTS {
|
|
|
5222
5263
|
}
|
|
5223
5264
|
/** local TUI settings (preview mode, last draft per workflow) — gitignored */
|
|
5224
5265
|
get settingsPath() {
|
|
5225
|
-
return
|
|
5266
|
+
return settingsPathFor(this.rootPath);
|
|
5226
5267
|
}
|
|
5227
5268
|
resolveFromHosts(relativePath) {
|
|
5228
5269
|
return asAbsolutePath(join(this.hostsFolder, relativePath));
|