comfy-ts 1.1.0 → 1.3.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 +61 -8
- package/dist/{DefinedWorkflow-BYyu5dK9.js → DefinedWorkflow-gpknV-5f.js} +52 -35
- package/dist/DefinedWorkflow-gpknV-5f.js.map +1 -0
- package/dist/DraftsSt-DmA0jWGl.js +434 -0
- package/dist/DraftsSt-DmA0jWGl.js.map +1 -0
- package/dist/cli.js +17 -4555
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +184 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -23
- package/dist/index.d.ts +36 -5
- package/dist/index.js +184 -32
- package/dist/index.js.map +1 -1
- package/dist/run-serve-Bn6yIJB0.js +638 -0
- package/dist/run-serve-Bn6yIJB0.js.map +1 -0
- package/dist/{run-tui-DZ22HDHI.js → run-tui-BtjaOXRh.js} +791 -395
- package/dist/run-tui-BtjaOXRh.js.map +1 -0
- package/dist/state-DKCPy105.js +4690 -0
- package/dist/state-DKCPy105.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 +6 -2
- package/src/cli/comfy-ts-cli.ts +15 -5
- package/src/cli/serve/ServeApp.ts +378 -0
- package/src/cli/serve/applyVarPayload.ts +119 -0
- package/src/cli/serve/describeVar.ts +74 -0
- package/src/cli/serve/run-serve.ts +169 -0
- 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 +29 -9
- package/src/cli/tui/components/TreePanel.tsx +33 -9
- package/src/cli/tui/components/TuiApp.tsx +54 -7
- package/src/cli/tui/components/VarsPanel.tsx +67 -34
- package/src/cli/tui/imageClipboard.ts +39 -0
- package/src/cli/tui/imagePicker/fsListing.ts +6 -4
- package/src/cli/tui/listWindow.ts +36 -0
- 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 +156 -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 +164 -36
- package/src/cli/tui/state/TuiSt.ts +81 -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/litegraph/convertFlowToLiteGraphJSON.ts +11 -7
- package/src/runner/ComfyExecution.ts +21 -4
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/runner/outputPath.ts +75 -0
- package/src/sdk-generator/inputWidgetKind.ts +50 -11
- package/src/sdk-generator/litegraphToApiRequestPayload.ts +14 -7
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +33 -4
- package/src/vars/DefinedWorkflow.ts +21 -8
- 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";
|
|
@@ -15973,6 +15973,9 @@ declare class SeedVar extends ComfyVar<number> {
|
|
|
15973
15973
|
/** move the seed to what the NEXT run should use, per mode */
|
|
15974
15974
|
advance(): this;
|
|
15975
15975
|
afterRun(): void;
|
|
15976
|
+
/** mode is part of the seed's state: a reset must not keep a caller's `?`/`+` alive
|
|
15977
|
+
* ('=' is the construction default; drafts restore their own mode via loadJSON) */
|
|
15978
|
+
reset(): this;
|
|
15976
15979
|
/** parse `+` `- 12` `= 5` `?` or a bare number (=> fixed). Keeps the current number when none given */
|
|
15977
15980
|
parse(raw: string): boolean;
|
|
15978
15981
|
display(): string;
|
|
@@ -16057,11 +16060,22 @@ type SizePreset = {
|
|
|
16057
16060
|
};
|
|
16058
16061
|
/** SDXL-style ~1MP buckets, multiples of 64 — safe for most latent models */
|
|
16059
16062
|
declare const DEFAULT_SIZE_PRESETS: SizePreset[];
|
|
16060
|
-
/** width/height picker: presets + free `WxH` entry
|
|
16063
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
16064
|
+
* size of a linked image var (his ask 2026-07-30: the widget shows
|
|
16065
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
16061
16066
|
declare class SizeVar extends ComfyVar<SizeValue> {
|
|
16062
16067
|
readonly presets: SizePreset[];
|
|
16068
|
+
readonly imageVar?: ImageVar | undefined;
|
|
16063
16069
|
readonly kind: 'size';
|
|
16064
|
-
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string);
|
|
16070
|
+
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string, imageVar?: ImageVar | undefined);
|
|
16071
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
16072
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
16073
|
+
* image var itself, the size row simply disappears) */
|
|
16074
|
+
imageSize(): {
|
|
16075
|
+
width: number;
|
|
16076
|
+
height: number;
|
|
16077
|
+
name: string;
|
|
16078
|
+
} | null;
|
|
16065
16079
|
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
16066
16080
|
parse(raw: string): boolean;
|
|
16067
16081
|
display(): string;
|
|
@@ -16126,6 +16140,7 @@ declare const v: {
|
|
|
16126
16140
|
size: (defaultValue?: SizeValue, opts?: {
|
|
16127
16141
|
presets?: SizePreset[];
|
|
16128
16142
|
label?: string;
|
|
16143
|
+
image?: ImageVar;
|
|
16129
16144
|
}) => SizeVar;
|
|
16130
16145
|
image: (defaultValue: string, opts?: ImageVarOpts) => ImageVar;
|
|
16131
16146
|
};
|
|
@@ -16137,11 +16152,13 @@ declare const v: {
|
|
|
16137
16152
|
type AnyVar = {
|
|
16138
16153
|
readonly kind: VarKind;
|
|
16139
16154
|
readonly value: unknown;
|
|
16155
|
+
readonly defaultValue: unknown;
|
|
16140
16156
|
readonly label?: string;
|
|
16141
16157
|
/** the vars-spec key — DefinedWorkflow writes it at define time */
|
|
16142
16158
|
name?: string;
|
|
16143
16159
|
parse(raw: string): boolean;
|
|
16144
16160
|
loadJSON(value: unknown): unknown;
|
|
16161
|
+
reset(): unknown;
|
|
16145
16162
|
toJSON(): unknown;
|
|
16146
16163
|
outValue(): unknown;
|
|
16147
16164
|
display(): string;
|
|
@@ -16171,6 +16188,9 @@ type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
|
16171
16188
|
type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
16172
16189
|
/** short id; also names the workflow instances */
|
|
16173
16190
|
id?: string;
|
|
16191
|
+
/** optional TUI tree color (ink color name or hex); unset = the tree's
|
|
16192
|
+
* per-family palette (first `-` word of the module basename) */
|
|
16193
|
+
color?: string;
|
|
16174
16194
|
/** the tweakable knobs; drivers (scripts, TUI) edit these between runs.
|
|
16175
16195
|
* A LAMBDA gives cross-referencing vars a scope (loras + prompt with
|
|
16176
16196
|
* loraKeywordsFrom created inline) — resolved ONCE at define time, and it
|
|
@@ -16201,14 +16221,20 @@ declare class DefinedWorkflow<ID extends string = string, V extends VarsSpec = V
|
|
|
16201
16221
|
* (set by run()) fires each var's afterRun() right after snapshotting the
|
|
16202
16222
|
* values — atomically, before any await — so the graph uses this run's seed
|
|
16203
16223
|
* while the var moves to the next (queued runs get distinct seeds; a bare
|
|
16204
|
-
* build() for copy/export never advances).
|
|
16224
|
+
* build() for copy/export never advances). `p.host` substitutes the host
|
|
16225
|
+
* the graph is built against (TUI host override): node/model availability
|
|
16226
|
+
* there surfaces as workflow.problems / server validation, by design.
|
|
16205
16227
|
*/
|
|
16206
16228
|
build(p?: {
|
|
16207
16229
|
advance?: boolean;
|
|
16230
|
+
host?: ComfyHost<ID>;
|
|
16208
16231
|
}): Promise<ComfyWorkflow<ID>>;
|
|
16209
16232
|
/** 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
|
-
|
|
16233
|
+
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
16234
|
+
* `settings.host` runs against THAT host instead of the defining one. */
|
|
16235
|
+
run(settings?: RunSettings & {
|
|
16236
|
+
host?: ComfyHost<ID>;
|
|
16237
|
+
}): Promise<ComfyExecution>;
|
|
16212
16238
|
}
|
|
16213
16239
|
//#endregion
|
|
16214
16240
|
//#region src/host/ComfyHost.d.ts
|
|
@@ -16511,6 +16537,11 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16511
16537
|
private _unknownBinaryFrameTypes;
|
|
16512
16538
|
/** handy to keep around */
|
|
16513
16539
|
status: ComfyStatusData['status'] | null;
|
|
16540
|
+
/** last time ANY ws message arrived — proof-of-life for the TUI probe: a
|
|
16541
|
+
* busy single-threaded ComfyUI stalls NEW connects while established
|
|
16542
|
+
* sockets keep streaming (a half-open socket receives nothing, so this
|
|
16543
|
+
* never revives one) */
|
|
16544
|
+
lastWsMessageAt: number | null;
|
|
16514
16545
|
onMessage(e: MessageEvent): void;
|
|
16515
16546
|
}
|
|
16516
16547
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -15973,6 +15973,9 @@ declare class SeedVar extends ComfyVar<number> {
|
|
|
15973
15973
|
/** move the seed to what the NEXT run should use, per mode */
|
|
15974
15974
|
advance(): this;
|
|
15975
15975
|
afterRun(): void;
|
|
15976
|
+
/** mode is part of the seed's state: a reset must not keep a caller's `?`/`+` alive
|
|
15977
|
+
* ('=' is the construction default; drafts restore their own mode via loadJSON) */
|
|
15978
|
+
reset(): this;
|
|
15976
15979
|
/** parse `+` `- 12` `= 5` `?` or a bare number (=> fixed). Keeps the current number when none given */
|
|
15977
15980
|
parse(raw: string): boolean;
|
|
15978
15981
|
display(): string;
|
|
@@ -16057,11 +16060,22 @@ type SizePreset = {
|
|
|
16057
16060
|
};
|
|
16058
16061
|
/** SDXL-style ~1MP buckets, multiples of 64 — safe for most latent models */
|
|
16059
16062
|
declare const DEFAULT_SIZE_PRESETS: SizePreset[];
|
|
16060
|
-
/** width/height picker: presets + free `WxH` entry
|
|
16063
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
16064
|
+
* size of a linked image var (his ask 2026-07-30: the widget shows
|
|
16065
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
16061
16066
|
declare class SizeVar extends ComfyVar<SizeValue> {
|
|
16062
16067
|
readonly presets: SizePreset[];
|
|
16068
|
+
readonly imageVar?: ImageVar | undefined;
|
|
16063
16069
|
readonly kind: 'size';
|
|
16064
|
-
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string);
|
|
16070
|
+
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string, imageVar?: ImageVar | undefined);
|
|
16071
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
16072
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
16073
|
+
* image var itself, the size row simply disappears) */
|
|
16074
|
+
imageSize(): {
|
|
16075
|
+
width: number;
|
|
16076
|
+
height: number;
|
|
16077
|
+
name: string;
|
|
16078
|
+
} | null;
|
|
16065
16079
|
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
16066
16080
|
parse(raw: string): boolean;
|
|
16067
16081
|
display(): string;
|
|
@@ -16126,6 +16140,7 @@ declare const v: {
|
|
|
16126
16140
|
size: (defaultValue?: SizeValue, opts?: {
|
|
16127
16141
|
presets?: SizePreset[];
|
|
16128
16142
|
label?: string;
|
|
16143
|
+
image?: ImageVar;
|
|
16129
16144
|
}) => SizeVar;
|
|
16130
16145
|
image: (defaultValue: string, opts?: ImageVarOpts) => ImageVar;
|
|
16131
16146
|
};
|
|
@@ -16137,11 +16152,13 @@ declare const v: {
|
|
|
16137
16152
|
type AnyVar = {
|
|
16138
16153
|
readonly kind: VarKind;
|
|
16139
16154
|
readonly value: unknown;
|
|
16155
|
+
readonly defaultValue: unknown;
|
|
16140
16156
|
readonly label?: string;
|
|
16141
16157
|
/** the vars-spec key — DefinedWorkflow writes it at define time */
|
|
16142
16158
|
name?: string;
|
|
16143
16159
|
parse(raw: string): boolean;
|
|
16144
16160
|
loadJSON(value: unknown): unknown;
|
|
16161
|
+
reset(): unknown;
|
|
16145
16162
|
toJSON(): unknown;
|
|
16146
16163
|
outValue(): unknown;
|
|
16147
16164
|
display(): string;
|
|
@@ -16171,6 +16188,9 @@ type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
|
16171
16188
|
type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
16172
16189
|
/** short id; also names the workflow instances */
|
|
16173
16190
|
id?: string;
|
|
16191
|
+
/** optional TUI tree color (ink color name or hex); unset = the tree's
|
|
16192
|
+
* per-family palette (first `-` word of the module basename) */
|
|
16193
|
+
color?: string;
|
|
16174
16194
|
/** the tweakable knobs; drivers (scripts, TUI) edit these between runs.
|
|
16175
16195
|
* A LAMBDA gives cross-referencing vars a scope (loras + prompt with
|
|
16176
16196
|
* loraKeywordsFrom created inline) — resolved ONCE at define time, and it
|
|
@@ -16201,14 +16221,20 @@ declare class DefinedWorkflow<ID extends string = string, V extends VarsSpec = V
|
|
|
16201
16221
|
* (set by run()) fires each var's afterRun() right after snapshotting the
|
|
16202
16222
|
* values — atomically, before any await — so the graph uses this run's seed
|
|
16203
16223
|
* while the var moves to the next (queued runs get distinct seeds; a bare
|
|
16204
|
-
* build() for copy/export never advances).
|
|
16224
|
+
* build() for copy/export never advances). `p.host` substitutes the host
|
|
16225
|
+
* the graph is built against (TUI host override): node/model availability
|
|
16226
|
+
* there surfaces as workflow.problems / server validation, by design.
|
|
16205
16227
|
*/
|
|
16206
16228
|
build(p?: {
|
|
16207
16229
|
advance?: boolean;
|
|
16230
|
+
host?: ComfyHost<ID>;
|
|
16208
16231
|
}): Promise<ComfyWorkflow<ID>>;
|
|
16209
16232
|
/** 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
|
-
|
|
16233
|
+
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
16234
|
+
* `settings.host` runs against THAT host instead of the defining one. */
|
|
16235
|
+
run(settings?: RunSettings & {
|
|
16236
|
+
host?: ComfyHost<ID>;
|
|
16237
|
+
}): Promise<ComfyExecution>;
|
|
16212
16238
|
}
|
|
16213
16239
|
//#endregion
|
|
16214
16240
|
//#region src/host/ComfyHost.d.ts
|
|
@@ -16511,6 +16537,11 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16511
16537
|
private _unknownBinaryFrameTypes;
|
|
16512
16538
|
/** handy to keep around */
|
|
16513
16539
|
status: ComfyStatusData['status'] | null;
|
|
16540
|
+
/** last time ANY ws message arrived — proof-of-life for the TUI probe: a
|
|
16541
|
+
* busy single-threaded ComfyUI stalls NEW connects while established
|
|
16542
|
+
* sockets keep streaming (a half-open socket receives nothing, so this
|
|
16543
|
+
* never revives one) */
|
|
16544
|
+
lastWsMessageAt: number | null;
|
|
16514
16545
|
onMessage(e: MessageEvent): void;
|
|
16515
16546
|
}
|
|
16516
16547
|
//#endregion
|