comfy-ts 2.13.0 → 2.15.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 +1 -0
- package/dist/{LogsSt-CUeo843w.js → LogsSt-C3UIWR-o.js} +2 -2
- package/dist/{LogsSt-CUeo843w.js.map → LogsSt-C3UIWR-o.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +213 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +123 -21
- package/dist/index.d.ts +123 -21
- package/dist/index.js +207 -54
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-DlRBv_Nk.js → run-serve-B5PfIuhK.js} +310 -88
- package/dist/run-serve-B5PfIuhK.js.map +1 -0
- package/dist/{run-tui-B5uxm2_l.js → run-tui-D-N4_yyX.js} +15 -9
- package/dist/run-tui-D-N4_yyX.js.map +1 -0
- package/dist/{schemaDrift-E95iTF7E.js → schemaDrift-BkN8rLiZ.js} +163 -25
- package/dist/schemaDrift-BkN8rLiZ.js.map +1 -0
- package/dist/serve-web.js +160 -71
- package/dist/{state-CUp2J1Zy.js → state-CZsYJqB6.js} +45 -35
- package/dist/state-CZsYJqB6.js.map +1 -0
- package/dist/web.d.ts +120 -21
- package/dist/web.js +196 -51
- package/dist/web.js.map +1 -1
- package/examples/media/README.md +8 -0
- package/examples/media/sine_440hz_3s.flac +0 -0
- package/examples/media/testsrc_256x256_3s.mp4 +0 -0
- package/examples/rvion/14-video-soundtrack.cflow.ts +47 -0
- package/guide-for-agents.md +2 -1
- package/package.json +2 -2
- package/src/cli/serve/ServeApp.ts +189 -110
- package/src/cli/serve/applyVarPayload.ts +5 -3
- package/src/cli/serve/describeVar.ts +5 -3
- package/src/cli/serve/resultHistory.ts +141 -0
- package/src/cli/serve/run-serve.ts +4 -1
- package/src/cli/serve/runError.ts +23 -0
- package/src/cli/serve/serveSettings.ts +17 -1
- package/src/cli/serve/web/api.ts +33 -2
- package/src/cli/serve/web/components/App.tsx +6 -4
- package/src/cli/serve/web/components/Gallery.tsx +116 -11
- package/src/cli/serve/web/components/Icon.tsx +4 -0
- package/src/cli/serve/web/components/MemoryBudget.tsx +98 -0
- package/src/cli/serve/web/components/RunError.tsx +19 -0
- package/src/cli/serve/web/components/ShortcutsModal.tsx +54 -0
- package/src/cli/serve/web/components/SideMenu.tsx +14 -0
- package/src/cli/serve/web/components/VarsForm.tsx +75 -55
- package/src/cli/serve/web/components/controls/BasicControls.tsx +8 -1
- package/src/cli/serve/web/components/controls/LorasControl.tsx +6 -3
- package/src/cli/serve/web/components/controls/MediaControl.tsx +111 -0
- package/src/cli/serve/web/promptEditor/promptExtensions.ts +3 -1
- package/src/cli/serve/web/state/FormSt.ts +70 -2
- package/src/cli/serve/web/state/RunSt.ts +61 -3
- package/src/cli/serve/web/state/WebSt.ts +26 -2
- package/src/cli/serve/web/state/formRows.ts +9 -0
- package/src/cli/serve/web/state/host.ts +2 -0
- package/src/cli/serve/web/state/keptResults.ts +26 -0
- package/src/cli/serve/web/state/lightbox.ts +17 -0
- package/src/cli/serve/web/state/mediaDrop.ts +76 -0
- package/src/cli/serve/web/state/shortcutCatalog.ts +100 -0
- package/src/cli/serve/web/state/shortcuts.ts +10 -0
- package/src/cli/serve/web/styles.ts +112 -24
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +4 -1
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +15 -6
- package/src/cli/tui/state/TuiSt.ts +1 -1
- package/src/coreExports.ts +10 -0
- package/src/exampleAssets.ts +13 -3
- package/src/host/ComfyUploader.ts +34 -27
- package/src/index.ts +1 -1
- package/src/runner/ComfyExecution.ts +38 -20
- package/src/runner/ComfyWsApi.ts +3 -0
- package/src/runner/mediaKinds.ts +51 -0
- package/src/vars/ComfyVars.ts +96 -22
- package/dist/run-serve-DlRBv_Nk.js.map +0 -1
- package/dist/run-tui-B5uxm2_l.js.map +0 -1
- package/dist/schemaDrift-E95iTF7E.js.map +0 -1
- package/dist/state-CUp2J1Zy.js.map +0 -1
- package/src/cli/serve/web/components/controls/ImageControl.tsx +0 -72
package/dist/web.d.ts
CHANGED
|
@@ -11946,6 +11946,16 @@ declare const types$1: import("arktype").Module<{
|
|
|
11946
11946
|
subfolder: string;
|
|
11947
11947
|
type: string;
|
|
11948
11948
|
}[] | undefined;
|
|
11949
|
+
video?: {
|
|
11950
|
+
filename: string;
|
|
11951
|
+
subfolder: string;
|
|
11952
|
+
type: string;
|
|
11953
|
+
}[] | undefined;
|
|
11954
|
+
gifs?: {
|
|
11955
|
+
filename: string;
|
|
11956
|
+
subfolder: string;
|
|
11957
|
+
type: string;
|
|
11958
|
+
}[] | undefined;
|
|
11949
11959
|
text?: unknown[] | undefined;
|
|
11950
11960
|
};
|
|
11951
11961
|
prompt_id: PromptID;
|
|
@@ -12027,6 +12037,16 @@ declare const types$1: import("arktype").Module<{
|
|
|
12027
12037
|
subfolder: string;
|
|
12028
12038
|
type: string;
|
|
12029
12039
|
}[] | undefined;
|
|
12040
|
+
video?: {
|
|
12041
|
+
filename: string;
|
|
12042
|
+
subfolder: string;
|
|
12043
|
+
type: string;
|
|
12044
|
+
}[] | undefined;
|
|
12045
|
+
gifs?: {
|
|
12046
|
+
filename: string;
|
|
12047
|
+
subfolder: string;
|
|
12048
|
+
type: string;
|
|
12049
|
+
}[] | undefined;
|
|
12030
12050
|
text?: unknown[] | undefined;
|
|
12031
12051
|
};
|
|
12032
12052
|
prompt_id: PromptID;
|
|
@@ -12094,6 +12114,16 @@ declare const types$1: import("arktype").Module<{
|
|
|
12094
12114
|
subfolder: string;
|
|
12095
12115
|
type: string;
|
|
12096
12116
|
}[] | undefined;
|
|
12117
|
+
video?: {
|
|
12118
|
+
filename: string;
|
|
12119
|
+
subfolder: string;
|
|
12120
|
+
type: string;
|
|
12121
|
+
}[] | undefined;
|
|
12122
|
+
gifs?: {
|
|
12123
|
+
filename: string;
|
|
12124
|
+
subfolder: string;
|
|
12125
|
+
type: string;
|
|
12126
|
+
}[] | undefined;
|
|
12097
12127
|
text?: unknown[] | undefined;
|
|
12098
12128
|
};
|
|
12099
12129
|
prompt_id: PromptID;
|
|
@@ -12200,6 +12230,16 @@ declare const types$1: import("arktype").Module<{
|
|
|
12200
12230
|
subfolder: string;
|
|
12201
12231
|
type: string;
|
|
12202
12232
|
}[] | undefined;
|
|
12233
|
+
video?: {
|
|
12234
|
+
filename: string;
|
|
12235
|
+
subfolder: string;
|
|
12236
|
+
type: string;
|
|
12237
|
+
}[] | undefined;
|
|
12238
|
+
gifs?: {
|
|
12239
|
+
filename: string;
|
|
12240
|
+
subfolder: string;
|
|
12241
|
+
type: string;
|
|
12242
|
+
}[] | undefined;
|
|
12203
12243
|
text?: unknown[] | undefined;
|
|
12204
12244
|
};
|
|
12205
12245
|
prompt_id: PromptID;
|
|
@@ -12695,6 +12735,9 @@ type ComfyAudioOutput = {
|
|
|
12695
12735
|
bytes: Uint8Array;
|
|
12696
12736
|
absPath: AbsolutePath | null;
|
|
12697
12737
|
};
|
|
12738
|
+
/** one video file an output node published (SaveVideo, SaveWEBM, VHS_VideoCombine), same
|
|
12739
|
+
* shape and same retrieval as an audio file */
|
|
12740
|
+
type ComfyVideoOutput = ComfyAudioOutput;
|
|
12698
12741
|
/** one text output as an output node published it (`nodeKey` is null when the node left the snapshot) */
|
|
12699
12742
|
type ComfyTextOutput = {
|
|
12700
12743
|
nodeId: ComfyNodeId;
|
|
@@ -12766,7 +12809,14 @@ declare class ComfyExecution {
|
|
|
12766
12809
|
}[];
|
|
12767
12810
|
/** audio files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
12768
12811
|
audios: ComfyAudioOutput[];
|
|
12769
|
-
|
|
12812
|
+
/** video retrievals that failed (their files are missing from `videos`) */
|
|
12813
|
+
videoErrors: {
|
|
12814
|
+
video: ComfyImageInfo;
|
|
12815
|
+
error: unknown;
|
|
12816
|
+
}[];
|
|
12817
|
+
/** video files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
12818
|
+
videos: ComfyVideoOutput[];
|
|
12819
|
+
private retrieveFile;
|
|
12770
12820
|
/** image retrievals that failed (their images are missing from `images`);
|
|
12771
12821
|
* `image` is null for SaveImageWebsocket frames (no server-side file info exists) */
|
|
12772
12822
|
imageErrors: {
|
|
@@ -15885,12 +15935,29 @@ type ComfyUploadImageResult = {
|
|
|
15885
15935
|
declare class ComfyUploader {
|
|
15886
15936
|
host: ComfyHost;
|
|
15887
15937
|
constructor(host: ComfyHost);
|
|
15888
|
-
/**
|
|
15938
|
+
/** names this process already uploaded to this host: a LoadAudio or LoadVideo list is not
|
|
15939
|
+
* reloaded after an upload, so without it every run re-sent the same file */
|
|
15940
|
+
private uploaded;
|
|
15941
|
+
/** upload an image (hash-named, deduped against the host's LoadImage list) */
|
|
15889
15942
|
uploadImage: (img: MediaImage, p: {
|
|
15890
15943
|
type?: Maybe<'input' | 'temp' | 'output'>;
|
|
15891
15944
|
override?: Maybe<boolean>;
|
|
15892
15945
|
subfolder?: string;
|
|
15893
15946
|
}) => Promise<ComfyImageName>;
|
|
15947
|
+
/**
|
|
15948
|
+
* THE upload path: any file a loader node reads from the host's input folder. ComfyUI routes
|
|
15949
|
+
* audio and video through `/upload/image` too. `slot` is the loader input whose value list
|
|
15950
|
+
* says the file is already there (`LoadImage.image`, `LoadAudio.audio`, `LoadVideo.file`)
|
|
15951
|
+
*/
|
|
15952
|
+
uploadInput: (p: {
|
|
15953
|
+
blob: Blob;
|
|
15954
|
+
/** the name the file should get on the host, hash-derived by callers so reruns dedupe */
|
|
15955
|
+
name: string;
|
|
15956
|
+
slot: string;
|
|
15957
|
+
type?: Maybe<'input' | 'temp' | 'output'>;
|
|
15958
|
+
override?: Maybe<boolean>;
|
|
15959
|
+
subfolder?: string;
|
|
15960
|
+
}) => Promise<string>;
|
|
15894
15961
|
}
|
|
15895
15962
|
//#endregion
|
|
15896
15963
|
//#region src/host/hostUrl.d.ts
|
|
@@ -16078,6 +16145,9 @@ declare function toPresetList(spec: VarPresetSpec | undefined): VarPreset[];
|
|
|
16078
16145
|
/** which preset the value still IS, or null once it was hand-edited (trailing whitespace ignored) */
|
|
16079
16146
|
declare function activePresetLabel(presets: readonly VarPreset[], value: string): string | null;
|
|
16080
16147
|
//#endregion
|
|
16148
|
+
//#region src/runner/mediaKinds.d.ts
|
|
16149
|
+
type MediaKind = 'image' | 'audio' | 'video';
|
|
16150
|
+
//#endregion
|
|
16081
16151
|
//#region src/vars/ComfyVars.d.ts
|
|
16082
16152
|
/**
|
|
16083
16153
|
* the var's CLASS, and the only safe way to discriminate one: `instanceof` compares class
|
|
@@ -16087,7 +16157,7 @@ declare function activePresetLabel(presets: readonly VarPreset[], value: string)
|
|
|
16087
16157
|
* in a consumer app: "var 'prompt' has unsupported kind 'text'", for EVERY kind). A string tag
|
|
16088
16158
|
* crosses bundles; a class identity does not.
|
|
16089
16159
|
*/
|
|
16090
|
-
type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' |
|
|
16160
|
+
type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' | MediaKind;
|
|
16091
16161
|
/**
|
|
16092
16162
|
* full base: T is what's STORED/edited, Out what the GRAPH consumes at build
|
|
16093
16163
|
* time. They usually coincide — extend `ComfyVar<T>` for that. PromptVar is
|
|
@@ -16477,35 +16547,44 @@ declare class SizeVar extends ComfyVar<SizeValue> {
|
|
|
16477
16547
|
parse(raw: string): boolean;
|
|
16478
16548
|
display(): string;
|
|
16479
16549
|
}
|
|
16480
|
-
type
|
|
16550
|
+
type MediaVarOpts = {
|
|
16481
16551
|
/** where the TUI picker starts browsing AND what relative values resolve against (absPath) */
|
|
16482
16552
|
folder?: string;
|
|
16483
16553
|
/** picker listing filter, lowercase without dots; never affects the value. NOT a security
|
|
16484
|
-
* boundary: `comfy-ts serve` keeps its own floor of
|
|
16554
|
+
* boundary: `comfy-ts serve` keeps its own floor of media types it will read off the disk
|
|
16485
16555
|
* and upload, which this list may NARROW but never widen (emptying it changes the picker,
|
|
16486
16556
|
* not what the api accepts) */
|
|
16487
16557
|
extensions?: readonly string[];
|
|
16488
16558
|
label?: string;
|
|
16489
16559
|
};
|
|
16560
|
+
type ImageVarOpts = MediaVarOpts;
|
|
16561
|
+
type AudioVarOpts = MediaVarOpts;
|
|
16562
|
+
type VideoVarOpts = MediaVarOpts;
|
|
16490
16563
|
declare const DEFAULT_IMAGE_EXTENSIONS: readonly string[];
|
|
16491
|
-
|
|
16492
|
-
declare
|
|
16564
|
+
declare const DEFAULT_AUDIO_EXTENSIONS: readonly string[];
|
|
16565
|
+
declare const DEFAULT_VIDEO_EXTENSIONS: readonly string[];
|
|
16566
|
+
/** empty media var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
16567
|
+
declare class MediaVarEmptyError extends Error {
|
|
16493
16568
|
readonly varName: string;
|
|
16569
|
+
readonly media: MediaKind;
|
|
16494
16570
|
/** name, not instanceof: the cli bundle and dist/index.js each define this class */
|
|
16495
|
-
readonly name
|
|
16496
|
-
constructor(varName: string);
|
|
16571
|
+
readonly name: string;
|
|
16572
|
+
constructor(varName: string, media?: MediaKind);
|
|
16497
16573
|
}
|
|
16574
|
+
/** the image-only name this error had first; the same class */
|
|
16575
|
+
declare const ImageVarEmptyError: typeof MediaVarEmptyError;
|
|
16576
|
+
type ImageVarEmptyError = MediaVarEmptyError;
|
|
16498
16577
|
/**
|
|
16499
|
-
* a local
|
|
16578
|
+
* a local media file path. The VALUE is a PLAIN PATH STRING — text-encodable,
|
|
16500
16579
|
* drafts persist it verbatim (toJSON = the string), hand-editable in the
|
|
16501
|
-
* draft json. Empty = unset: outValue()/absPath() throw
|
|
16502
|
-
* so a build never runs on a silent placeholder. The TUI opens the
|
|
16503
|
-
* picker overlay for kind
|
|
16504
|
-
*/
|
|
16505
|
-
declare class
|
|
16506
|
-
opts:
|
|
16507
|
-
readonly kind:
|
|
16508
|
-
constructor(defaultValue: string, opts?:
|
|
16580
|
+
* draft json. Empty = unset: outValue()/absPath() throw MediaVarEmptyError,
|
|
16581
|
+
* so a build never runs on a silent placeholder. The TUI opens the file
|
|
16582
|
+
* picker overlay for every media kind.
|
|
16583
|
+
*/
|
|
16584
|
+
declare abstract class MediaVar extends ComfyVar<string> {
|
|
16585
|
+
opts: MediaVarOpts;
|
|
16586
|
+
abstract readonly kind: MediaKind;
|
|
16587
|
+
constructor(defaultValue: string, opts?: MediaVarOpts);
|
|
16509
16588
|
/** what the picker lists (lowercase, no dots) */
|
|
16510
16589
|
get extensions(): readonly string[];
|
|
16511
16590
|
set(value: string): this;
|
|
@@ -16517,8 +16596,26 @@ declare class ImageVar extends ComfyVar<string> {
|
|
|
16517
16596
|
/** empty = unset: the build fails LOUD here (varValues calls outValue) */
|
|
16518
16597
|
outValue(): string;
|
|
16519
16598
|
display(): string;
|
|
16599
|
+
/** upload the file hash-named (reruns dedupe) and add this medium's loader node. A dry
|
|
16600
|
+
* build names the file by its hash and uploads nothing */
|
|
16601
|
+
protected loadVia(wf: ComfyWorkflow<string>): Promise<unknown>;
|
|
16602
|
+
}
|
|
16603
|
+
/** a local image path, loaded through LoadImage */
|
|
16604
|
+
declare class ImageVar extends MediaVar {
|
|
16605
|
+
readonly kind: 'image';
|
|
16606
|
+
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadImage'>>;
|
|
16607
|
+
}
|
|
16608
|
+
/** a local audio path, loaded through LoadAudio */
|
|
16609
|
+
declare class AudioVar extends MediaVar {
|
|
16610
|
+
readonly kind: 'audio';
|
|
16611
|
+
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadAudio'>>;
|
|
16612
|
+
}
|
|
16613
|
+
/** a local video path, loaded through LoadVideo */
|
|
16614
|
+
declare class VideoVar extends MediaVar {
|
|
16615
|
+
readonly kind: 'video';
|
|
16616
|
+
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadVideo'>>;
|
|
16520
16617
|
}
|
|
16521
|
-
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image */
|
|
16618
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image / v.audio / v.video */
|
|
16522
16619
|
declare const v: {
|
|
16523
16620
|
text: (defaultValue: string, opts?: TextVarOpts | string) => TextVar;
|
|
16524
16621
|
prompt: (
|
|
@@ -16553,7 +16650,9 @@ declare const v: {
|
|
|
16553
16650
|
label?: string;
|
|
16554
16651
|
image?: ImageVar;
|
|
16555
16652
|
}) => SizeVar;
|
|
16556
|
-
image: (defaultValue: string, opts?:
|
|
16653
|
+
image: (defaultValue: string, opts?: MediaVarOpts) => ImageVar;
|
|
16654
|
+
audio: (defaultValue: string, opts?: MediaVarOpts) => AudioVar;
|
|
16655
|
+
video: (defaultValue: string, opts?: MediaVarOpts) => VideoVar;
|
|
16557
16656
|
};
|
|
16558
16657
|
/**
|
|
16559
16658
|
* structural face of any var: readonly `value` keeps ComfyVar<T> assignable
|
|
@@ -17944,5 +18043,5 @@ type HostToPanel = {
|
|
|
17944
18043
|
comfyTs: 'get-state';
|
|
17945
18044
|
};
|
|
17946
18045
|
//#endregion
|
|
17947
|
-
export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyChoiceVar, type AnyVar, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, type ChoiceSelect, ChoiceVar, type CodegenOptions, type ComfyApiJson, type ComfyApiNodeJson, type ComfyAudioOutput, ComfyExecution, type ComfyExecutionData, type ComfyExecutionStatus, ComfyHost, ComfyHostAuthError, type ComfyHostData, type ComfyHostID, ComfyHostUnreachableError, type ComfyImageName, ComfyManager, ComfyNode, type ComfyNodeId, type ComfyNodeIdMode, type ComfyNodeMetadata, ComfyNodeOutput, type ComfyNodeSchemaJSON, ComfySchema, type ComfySchemaJSON, ComfySdkBase, ComfySdkShape, type ComfyStorage, ComfyTS, type ComfyTextOutput, type ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, type HostToPanel, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LmLoraItem, type LoraEntry, type LoraLane, type LoraLanes, type LoraMirror, type LoraNameOf, type LoraRecord, type LoraStrength, type LoraSweep, type LorasHost, type LorasInput, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type PanelError, type PanelHostAction, type PanelRequest, type PanelResultAction, type PanelState, type PanelToHost, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptID, type PromptInput, type PromptLane, type PromptLanes, type PromptRelated_WsMsg, type PromptTagsOpts, type PromptValue, PromptVar, type PromptVarOpts, type QualifiedNodeKey, RelativePath, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SD15_SIZE_PRESETS, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, Tagged, TextVar, type TextVarOpts, ToggleVar, type VarKind, type VarPreset, type VarPresetSpec, type VarUi, type VarValues, type VarsSpec, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
18046
|
+
export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyChoiceVar, type AnyVar, AudioVar, type AudioVarOpts, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, type ChoiceSelect, ChoiceVar, type CodegenOptions, type ComfyApiJson, type ComfyApiNodeJson, type ComfyAudioOutput, ComfyExecution, type ComfyExecutionData, type ComfyExecutionStatus, ComfyHost, ComfyHostAuthError, type ComfyHostData, type ComfyHostID, ComfyHostUnreachableError, type ComfyImageName, ComfyManager, ComfyNode, type ComfyNodeId, type ComfyNodeIdMode, type ComfyNodeMetadata, ComfyNodeOutput, type ComfyNodeSchemaJSON, ComfySchema, type ComfySchemaJSON, ComfySdkBase, ComfySdkShape, type ComfyStorage, ComfyTS, type ComfyTextOutput, type ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, type ComfyVideoOutput, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, type HostToPanel, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LmLoraItem, type LoraEntry, type LoraLane, type LoraLanes, type LoraMirror, type LoraNameOf, type LoraRecord, type LoraStrength, type LoraSweep, type LorasHost, type LorasInput, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, MediaVar, MediaVarEmptyError, type MediaVarOpts, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type PanelError, type PanelHostAction, type PanelRequest, type PanelResultAction, type PanelState, type PanelToHost, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptID, type PromptInput, type PromptLane, type PromptLanes, type PromptRelated_WsMsg, type PromptTagsOpts, type PromptValue, PromptVar, type PromptVarOpts, type QualifiedNodeKey, RelativePath, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SD15_SIZE_PRESETS, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, Tagged, TextVar, type TextVarOpts, ToggleVar, type VarKind, type VarPreset, type VarPresetSpec, type VarUi, type VarValues, type VarsSpec, VideoVar, type VideoVarOpts, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
17948
18047
|
//# sourceMappingURL=web.d.ts.map
|
package/dist/web.js
CHANGED
|
@@ -101,7 +101,7 @@ function getComfyStorage() {
|
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region package.json
|
|
104
|
-
var version = "2.
|
|
104
|
+
var version = "2.15.0";
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
107
107
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -2008,6 +2008,8 @@ const types$1 = scope({
|
|
|
2008
2008
|
"previews?": [{ filepath: "string" }, "[]"],
|
|
2009
2009
|
"images?": "ComfyImageInfo[]",
|
|
2010
2010
|
"audio?": "ComfyImageInfo[]",
|
|
2011
|
+
"video?": "ComfyImageInfo[]",
|
|
2012
|
+
"gifs?": "ComfyImageInfo[]",
|
|
2011
2013
|
"text?": "unknown[]"
|
|
2012
2014
|
},
|
|
2013
2015
|
prompt_id: "PromptID"
|
|
@@ -2254,24 +2256,79 @@ var MediaImage = class MediaImage {
|
|
|
2254
2256
|
}
|
|
2255
2257
|
};
|
|
2256
2258
|
//#endregion
|
|
2257
|
-
//#region src/runner/
|
|
2258
|
-
/**
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2259
|
+
//#region src/runner/mediaKinds.ts
|
|
2260
|
+
/** picker defaults per kind, lowercase without dots */
|
|
2261
|
+
const DEFAULT_MEDIA_EXTENSIONS = {
|
|
2262
|
+
image: [
|
|
2263
|
+
"png",
|
|
2264
|
+
"jpg",
|
|
2265
|
+
"jpeg",
|
|
2266
|
+
"webp",
|
|
2267
|
+
"gif"
|
|
2268
|
+
],
|
|
2269
|
+
audio: [
|
|
2270
|
+
"wav",
|
|
2271
|
+
"flac",
|
|
2272
|
+
"mp3",
|
|
2273
|
+
"ogg",
|
|
2274
|
+
"opus",
|
|
2275
|
+
"m4a"
|
|
2276
|
+
],
|
|
2277
|
+
video: [
|
|
2278
|
+
"mp4",
|
|
2279
|
+
"webm",
|
|
2280
|
+
"mov",
|
|
2281
|
+
"mkv",
|
|
2282
|
+
"m4v"
|
|
2283
|
+
]
|
|
2284
|
+
};
|
|
2285
|
+
const MIMES = {
|
|
2286
|
+
png: "image/png",
|
|
2287
|
+
jpg: "image/jpeg",
|
|
2288
|
+
jpeg: "image/jpeg",
|
|
2289
|
+
webp: "image/webp",
|
|
2290
|
+
gif: "image/gif",
|
|
2264
2291
|
flac: "audio/flac",
|
|
2265
2292
|
mp3: "audio/mpeg",
|
|
2266
2293
|
opus: "audio/ogg",
|
|
2267
2294
|
ogg: "audio/ogg",
|
|
2268
2295
|
wav: "audio/wav",
|
|
2269
|
-
m4a: "audio/mp4"
|
|
2296
|
+
m4a: "audio/mp4",
|
|
2297
|
+
aac: "audio/aac",
|
|
2298
|
+
mp4: "video/mp4",
|
|
2299
|
+
m4v: "video/mp4",
|
|
2300
|
+
webm: "video/webm",
|
|
2301
|
+
mov: "video/quicktime",
|
|
2302
|
+
mkv: "video/x-matroska",
|
|
2303
|
+
avi: "video/x-msvideo"
|
|
2270
2304
|
};
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2305
|
+
/** video containers an output node can name. An animated webp or gif is an IMAGE: the
|
|
2306
|
+
* extension decides, never the `animated` flag */
|
|
2307
|
+
const VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2308
|
+
"mp4",
|
|
2309
|
+
"m4v",
|
|
2310
|
+
"webm",
|
|
2311
|
+
"mov",
|
|
2312
|
+
"mkv",
|
|
2313
|
+
"avi"
|
|
2314
|
+
]);
|
|
2315
|
+
function extensionOf(filename) {
|
|
2316
|
+
const dot = filename.lastIndexOf(".");
|
|
2317
|
+
return dot < 0 ? "" : filename.slice(dot + 1).toLowerCase();
|
|
2318
|
+
}
|
|
2319
|
+
function isVideoFilename(filename) {
|
|
2320
|
+
return VIDEO_EXTENSIONS.has(extensionOf(filename));
|
|
2274
2321
|
}
|
|
2322
|
+
function mediaMime(filename) {
|
|
2323
|
+
return MIMES[extensionOf(filename)] ?? "application/octet-stream";
|
|
2324
|
+
}
|
|
2325
|
+
//#endregion
|
|
2326
|
+
//#region src/runner/ComfyExecution.ts
|
|
2327
|
+
/** paths claimed by in-flight retrievals: two same-second runs on a
|
|
2328
|
+
* counter-resetting cloud host compute the same name before either writes.
|
|
2329
|
+
* A claim is released as soon as the write lands (the file itself then holds
|
|
2330
|
+
* the name) or fails (the name is free again) — the set never accumulates */
|
|
2331
|
+
const CLAIMED_OUTPUT_PATHS = /* @__PURE__ */ new Set();
|
|
2275
2332
|
var ComfyExecution = class {
|
|
2276
2333
|
get host() {
|
|
2277
2334
|
return this.workflow.host;
|
|
@@ -2338,15 +2395,28 @@ var ComfyExecution = class {
|
|
|
2338
2395
|
text: entry
|
|
2339
2396
|
});
|
|
2340
2397
|
}
|
|
2341
|
-
const
|
|
2342
|
-
|
|
2398
|
+
const out = msg.data.output;
|
|
2399
|
+
const listed = [
|
|
2400
|
+
...out?.images ?? [],
|
|
2401
|
+
...out?.video ?? [],
|
|
2402
|
+
...out?.gifs ?? []
|
|
2403
|
+
].filter((f) => f.type !== "input");
|
|
2404
|
+
for (const video of listed.filter((f) => isVideoFilename(f.filename))) this.pendingPromises.push(this.retrieveFile("video", video, promptNodeID).catch((e) => {
|
|
2405
|
+
console.error(`🔴 failed to retrieve ${video.filename}:`, e);
|
|
2406
|
+
this.videoErrors.push({
|
|
2407
|
+
video,
|
|
2408
|
+
error: e
|
|
2409
|
+
});
|
|
2410
|
+
}));
|
|
2411
|
+
const images = listed.filter((f) => !isVideoFilename(f.filename));
|
|
2412
|
+
if (images.length > 0) for (const img of images) this.pendingPromises.push(this.retrieveImage(img, promptNodeID).catch((e) => {
|
|
2343
2413
|
console.error(`🔴 failed to retrieve ${img.filename}:`, e);
|
|
2344
2414
|
this.imageErrors.push({
|
|
2345
2415
|
image: img,
|
|
2346
2416
|
error: e
|
|
2347
2417
|
});
|
|
2348
2418
|
}));
|
|
2349
|
-
for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.
|
|
2419
|
+
for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.retrieveFile("audio", audio, promptNodeID).catch((e) => {
|
|
2350
2420
|
console.error(`🔴 failed to retrieve ${audio.filename}:`, e);
|
|
2351
2421
|
this.audioErrors.push({
|
|
2352
2422
|
audio,
|
|
@@ -2357,13 +2427,16 @@ var ComfyExecution = class {
|
|
|
2357
2427
|
this.pendingPromises = [];
|
|
2358
2428
|
this.audioErrors = [];
|
|
2359
2429
|
this.audios = [];
|
|
2360
|
-
this.
|
|
2430
|
+
this.videoErrors = [];
|
|
2431
|
+
this.videos = [];
|
|
2432
|
+
this.retrieveFile = async (kind, info, promptNodeID) => {
|
|
2361
2433
|
const response = await this.host.fetchFile("/view?" + new URLSearchParams(info).toString());
|
|
2362
2434
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
2363
|
-
const mime =
|
|
2435
|
+
const mime = mediaMime(info.filename);
|
|
2436
|
+
const list = kind === "audio" ? this.audios : this.videos;
|
|
2364
2437
|
const sf = this.save;
|
|
2365
2438
|
if (sf == null) {
|
|
2366
|
-
|
|
2439
|
+
list.push({
|
|
2367
2440
|
nodeId: promptNodeID,
|
|
2368
2441
|
filename: info.filename,
|
|
2369
2442
|
mime,
|
|
@@ -2383,7 +2456,7 @@ var ComfyExecution = class {
|
|
|
2383
2456
|
subfolder: info.subfolder,
|
|
2384
2457
|
filename: info.filename
|
|
2385
2458
|
});
|
|
2386
|
-
|
|
2459
|
+
list.push({
|
|
2387
2460
|
nodeId: promptNodeID,
|
|
2388
2461
|
filename: info.filename,
|
|
2389
2462
|
mime,
|
|
@@ -2563,6 +2636,7 @@ var ComfyExecution = class {
|
|
|
2563
2636
|
const p = this.progress;
|
|
2564
2637
|
const outputs = [`${this.images.length} image(s)`];
|
|
2565
2638
|
if (this.audios.length > 0) outputs.push(`${this.audios.length} audio(s)`);
|
|
2639
|
+
if (this.videos.length > 0) outputs.push(`${this.videos.length} video(s)`);
|
|
2566
2640
|
if (this.texts.length > 0) outputs.push(`${this.texts.length} text(s)`);
|
|
2567
2641
|
const line = `${this.status === "Failure" ? "🔴" : "🟢"} ${this.status.toLowerCase()} in ${(p.elapsedMs / 1e3).toFixed(1)}s · ${outputs.join(" · ")}`;
|
|
2568
2642
|
if (globalThis.process?.stdout?.isTTY) process.stdout.write(`\r\x1b[2K${line}\n`);
|
|
@@ -3912,15 +3986,23 @@ const ComfyUploadImageResult_ark = type({
|
|
|
3912
3986
|
var ComfyUploader = class {
|
|
3913
3987
|
constructor(host) {
|
|
3914
3988
|
this.host = host;
|
|
3989
|
+
this.uploaded = /* @__PURE__ */ new Set();
|
|
3915
3990
|
this.uploadImage = async (img, p) => {
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3991
|
+
return await this.uploadInput({
|
|
3992
|
+
blob: img.getAsBlob(),
|
|
3993
|
+
name: img.enumName,
|
|
3994
|
+
...p,
|
|
3995
|
+
slot: "LoadImage.image"
|
|
3996
|
+
});
|
|
3997
|
+
};
|
|
3998
|
+
this.uploadInput = async (p) => {
|
|
3999
|
+
const expectedFinalName = p.subfolder ? `${p.subfolder}/${p.name}` : p.name;
|
|
4000
|
+
if (this.uploaded.has(expectedFinalName) || this.host.schema.stringValues(p.slot).includes(expectedFinalName)) {
|
|
4001
|
+
console.log(`[🌁] UPLOAD: 🩶 "${expectedFinalName}" already exists on current ComfyUI instance`);
|
|
3920
4002
|
return expectedFinalName;
|
|
3921
4003
|
}
|
|
3922
4004
|
const form = new FormData();
|
|
3923
|
-
form.set("image",
|
|
4005
|
+
form.set("image", p.blob, p.name);
|
|
3924
4006
|
if (p.type) form.set("type", p.type);
|
|
3925
4007
|
if (p.override ?? true) form.set("override", "true");
|
|
3926
4008
|
if (p.subfolder) form.set("subfolder", p.subfolder);
|
|
@@ -3930,11 +4012,11 @@ var ComfyUploader = class {
|
|
|
3930
4012
|
});
|
|
3931
4013
|
const result = softValidate(ComfyUploadImageResult_ark, await resp.json());
|
|
3932
4014
|
console.log("[🌁] UPLOAD: ✅ got", result);
|
|
3933
|
-
if (result.name == null) throw new Error(
|
|
4015
|
+
if (result.name == null) throw new Error(`upload of '${p.name}' failed: the host answered no name`);
|
|
3934
4016
|
const finalName = result.subfolder ? `${result.subfolder}/${result.name}` : result.name;
|
|
3935
4017
|
if (finalName !== expectedFinalName) console.warn(`[🌁] UPLOAD: ⚠️ expected "${expectedFinalName}" but got "${finalName}"`);
|
|
3936
|
-
|
|
3937
|
-
this.
|
|
4018
|
+
if (p.slot === "LoadImage.image") this.host.schema.unsafely_addImageInSchemaWithoutReloading(finalName);
|
|
4019
|
+
this.uploaded.add(finalName);
|
|
3938
4020
|
return finalName;
|
|
3939
4021
|
};
|
|
3940
4022
|
}
|
|
@@ -5319,42 +5401,55 @@ var SizeVar = class extends ComfyVar {
|
|
|
5319
5401
|
return `${width}×${height}${hit ? ` (${hit.label})` : ""}`;
|
|
5320
5402
|
}
|
|
5321
5403
|
};
|
|
5322
|
-
const DEFAULT_IMAGE_EXTENSIONS =
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
"
|
|
5328
|
-
|
|
5329
|
-
/** empty image var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
5330
|
-
var ImageVarEmptyError = class extends Error {
|
|
5331
|
-
constructor(varName) {
|
|
5332
|
-
super(`image var '${varName}' is empty — pick a file (TUI: activate the var; script: .set('/path/to/image.png'))`);
|
|
5404
|
+
const DEFAULT_IMAGE_EXTENSIONS = DEFAULT_MEDIA_EXTENSIONS.image;
|
|
5405
|
+
const DEFAULT_AUDIO_EXTENSIONS = DEFAULT_MEDIA_EXTENSIONS.audio;
|
|
5406
|
+
const DEFAULT_VIDEO_EXTENSIONS = DEFAULT_MEDIA_EXTENSIONS.video;
|
|
5407
|
+
/** empty media var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
5408
|
+
var MediaVarEmptyError = class extends Error {
|
|
5409
|
+
constructor(varName, media = "image") {
|
|
5410
|
+
super(`${media} var '${varName}' is empty — pick a file (TUI: activate the var; script: .set('/path/to/file'))`);
|
|
5333
5411
|
this.varName = varName;
|
|
5334
|
-
this.
|
|
5412
|
+
this.media = media;
|
|
5413
|
+
this.name = "MediaVarEmptyError";
|
|
5335
5414
|
}
|
|
5336
5415
|
};
|
|
5337
|
-
/**
|
|
5416
|
+
/** the image-only name this error had first; the same class */
|
|
5417
|
+
const ImageVarEmptyError = MediaVarEmptyError;
|
|
5418
|
+
/** trim + expand a leading `~/` — every media var write funnels through this */
|
|
5338
5419
|
function expandUserPath(raw) {
|
|
5339
5420
|
const trimmed = raw.trim();
|
|
5340
5421
|
return trimmed.startsWith("~/") ? join(getComfyStorage().homedir(), trimmed.slice(2)) : trimmed;
|
|
5341
5422
|
}
|
|
5423
|
+
/** the loader node each medium goes through, and its file input */
|
|
5424
|
+
const MEDIA_LOADERS = {
|
|
5425
|
+
image: {
|
|
5426
|
+
node: "LoadImage",
|
|
5427
|
+
input: "image"
|
|
5428
|
+
},
|
|
5429
|
+
audio: {
|
|
5430
|
+
node: "LoadAudio",
|
|
5431
|
+
input: "audio"
|
|
5432
|
+
},
|
|
5433
|
+
video: {
|
|
5434
|
+
node: "LoadVideo",
|
|
5435
|
+
input: "file"
|
|
5436
|
+
}
|
|
5437
|
+
};
|
|
5342
5438
|
/**
|
|
5343
|
-
* a local
|
|
5439
|
+
* a local media file path. The VALUE is a PLAIN PATH STRING — text-encodable,
|
|
5344
5440
|
* drafts persist it verbatim (toJSON = the string), hand-editable in the
|
|
5345
|
-
* draft json. Empty = unset: outValue()/absPath() throw
|
|
5346
|
-
* so a build never runs on a silent placeholder. The TUI opens the
|
|
5347
|
-
* picker overlay for kind
|
|
5441
|
+
* draft json. Empty = unset: outValue()/absPath() throw MediaVarEmptyError,
|
|
5442
|
+
* so a build never runs on a silent placeholder. The TUI opens the file
|
|
5443
|
+
* picker overlay for every media kind.
|
|
5348
5444
|
*/
|
|
5349
|
-
var
|
|
5445
|
+
var MediaVar = class extends ComfyVar {
|
|
5350
5446
|
constructor(defaultValue, opts = {}) {
|
|
5351
5447
|
super(expandUserPath(defaultValue), opts.label);
|
|
5352
5448
|
this.opts = opts;
|
|
5353
|
-
this.kind = "image";
|
|
5354
5449
|
}
|
|
5355
5450
|
/** what the picker lists (lowercase, no dots) */
|
|
5356
5451
|
get extensions() {
|
|
5357
|
-
return this.opts.extensions ??
|
|
5452
|
+
return this.opts.extensions ?? DEFAULT_MEDIA_EXTENSIONS[this.kind];
|
|
5358
5453
|
}
|
|
5359
5454
|
set(value) {
|
|
5360
5455
|
return super.set(expandUserPath(value));
|
|
@@ -5367,7 +5462,7 @@ var ImageVar = class extends ComfyVar {
|
|
|
5367
5462
|
return this.value !== "";
|
|
5368
5463
|
}
|
|
5369
5464
|
emptyError() {
|
|
5370
|
-
return new
|
|
5465
|
+
return new MediaVarEmptyError(this.name ?? this.label ?? this.kind, this.kind);
|
|
5371
5466
|
}
|
|
5372
5467
|
/** the ONE resolution helper: absolute kept as-is, relative resolved against opts.folder, else cwd */
|
|
5373
5468
|
absPath() {
|
|
@@ -5385,8 +5480,56 @@ var ImageVar = class extends ComfyVar {
|
|
|
5385
5480
|
const home = getComfyStorage().homedir();
|
|
5386
5481
|
return this.value.startsWith(`${home}/`) ? `~${this.value.slice(home.length)}` : this.value;
|
|
5387
5482
|
}
|
|
5483
|
+
/** upload the file hash-named (reruns dedupe) and add this medium's loader node. A dry
|
|
5484
|
+
* build names the file by its hash and uploads nothing */
|
|
5485
|
+
async loadVia(wf) {
|
|
5486
|
+
const loader = MEDIA_LOADERS[this.kind];
|
|
5487
|
+
const factory = wf.builderBase[loader.node];
|
|
5488
|
+
if (factory == null) throw new Error(`host '${wf.host.data.id}' has no ${loader.node} node: ${this.kind} var '${this.name ?? "?"}' cannot load`);
|
|
5489
|
+
const abs = this.absPath();
|
|
5490
|
+
const bytes = getComfyStorage().readBytes(abs);
|
|
5491
|
+
const ext = extensionOf(abs);
|
|
5492
|
+
const name = `${hashArrayBuffer(bytes)}${ext === "" ? "" : `.${ext}`}`;
|
|
5493
|
+
const onHost = wf.dry ? name : await wf.host.uploader.uploadInput({
|
|
5494
|
+
blob: new Blob([bytes], { type: mediaMime(abs) }),
|
|
5495
|
+
name,
|
|
5496
|
+
slot: `${loader.node}.${loader.input}`,
|
|
5497
|
+
type: "input"
|
|
5498
|
+
});
|
|
5499
|
+
return factory({ [loader.input]: onHost });
|
|
5500
|
+
}
|
|
5501
|
+
};
|
|
5502
|
+
/** a local image path, loaded through LoadImage */
|
|
5503
|
+
var ImageVar = class extends MediaVar {
|
|
5504
|
+
constructor(..._args2) {
|
|
5505
|
+
super(..._args2);
|
|
5506
|
+
this.kind = "image";
|
|
5507
|
+
}
|
|
5508
|
+
async loadInWorkflow(wf) {
|
|
5509
|
+
return await this.loadVia(wf);
|
|
5510
|
+
}
|
|
5511
|
+
};
|
|
5512
|
+
/** a local audio path, loaded through LoadAudio */
|
|
5513
|
+
var AudioVar = class extends MediaVar {
|
|
5514
|
+
constructor(..._args3) {
|
|
5515
|
+
super(..._args3);
|
|
5516
|
+
this.kind = "audio";
|
|
5517
|
+
}
|
|
5518
|
+
async loadInWorkflow(wf) {
|
|
5519
|
+
return await this.loadVia(wf);
|
|
5520
|
+
}
|
|
5521
|
+
};
|
|
5522
|
+
/** a local video path, loaded through LoadVideo */
|
|
5523
|
+
var VideoVar = class extends MediaVar {
|
|
5524
|
+
constructor(..._args4) {
|
|
5525
|
+
super(..._args4);
|
|
5526
|
+
this.kind = "video";
|
|
5527
|
+
}
|
|
5528
|
+
async loadInWorkflow(wf) {
|
|
5529
|
+
return await this.loadVia(wf);
|
|
5530
|
+
}
|
|
5388
5531
|
};
|
|
5389
|
-
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image */
|
|
5532
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image / v.audio / v.video */
|
|
5390
5533
|
const v = {
|
|
5391
5534
|
text: (defaultValue, opts = {}) => new TextVar(defaultValue, typeof opts === "string" ? { label: opts } : opts),
|
|
5392
5535
|
prompt: (defaultValue, opts = {}) => new PromptVar(defaultValue, opts),
|
|
@@ -5401,7 +5544,9 @@ const v = {
|
|
|
5401
5544
|
choice,
|
|
5402
5545
|
loras: (options, initial = {}, label) => new LorasVar(options, initial, label),
|
|
5403
5546
|
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets ?? sizePresetsFor(defaultValue), opts.label, opts.image, opts.starred),
|
|
5404
|
-
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts)
|
|
5547
|
+
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts),
|
|
5548
|
+
audio: (defaultValue, opts = {}) => new AudioVar(defaultValue, opts),
|
|
5549
|
+
video: (defaultValue, opts = {}) => new VideoVar(defaultValue, opts)
|
|
5405
5550
|
};
|
|
5406
5551
|
function varValues(vars) {
|
|
5407
5552
|
const out = {};
|
|
@@ -6825,6 +6970,6 @@ function loraTag(name, strength = 1, clipStrength) {
|
|
|
6825
6970
|
*/
|
|
6826
6971
|
setDefaultComfyStorage(createMemoryStorage());
|
|
6827
6972
|
//#endregion
|
|
6828
|
-
export { ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, MultiChoiceVar, OptionalChoiceVar, PromptVar, ResilientWebSocketClient, SD15_SIZE_PRESETS, SeedVar, SizeVar, TextVar, ToggleVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
6973
|
+
export { AudioVar, ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, MediaVar, MediaVarEmptyError, MultiChoiceVar, OptionalChoiceVar, PromptVar, ResilientWebSocketClient, SD15_SIZE_PRESETS, SeedVar, SizeVar, TextVar, ToggleVar, VideoVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
6829
6974
|
|
|
6830
6975
|
//# sourceMappingURL=web.js.map
|