comfy-ts 2.15.0 → 2.16.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/dist/{LogsSt-C3UIWR-o.js → LogsSt-Ct7Le0S_.js} +2 -2
- package/dist/{LogsSt-C3UIWR-o.js.map → LogsSt-Ct7Le0S_.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +57 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -7
- package/dist/index.d.ts +55 -7
- package/dist/index.js +57 -4
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-B5PfIuhK.js → run-serve-C78hD7t9.js} +14 -5
- package/dist/run-serve-C78hD7t9.js.map +1 -0
- package/dist/{run-tui-D-N4_yyX.js → run-tui-nPETFRmk.js} +4 -4
- package/dist/{run-tui-D-N4_yyX.js.map → run-tui-nPETFRmk.js.map} +1 -1
- package/dist/{schemaDrift-BkN8rLiZ.js → schemaDrift-wb5XkrHV.js} +57 -4
- package/dist/schemaDrift-wb5XkrHV.js.map +1 -0
- package/dist/serve-web.js +48 -48
- package/dist/{state-CZsYJqB6.js → state-BMW57_M0.js} +3 -3
- package/dist/{state-CZsYJqB6.js.map → state-BMW57_M0.js.map} +1 -1
- package/dist/web.d.ts +55 -7
- package/dist/web.js +57 -4
- package/dist/web.js.map +1 -1
- package/examples/README.md +1 -0
- package/examples/media/README.md +6 -5
- package/examples/media/voice_en_6s.flac +0 -0
- package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +9 -1
- package/examples/rvion/10-anima-t2i.cflow.ts +8 -1
- package/examples/rvion/15-tts-voice-clone.cflow.ts +111 -0
- package/guide-for-agents.md +2 -1
- package/package.json +2 -2
- package/src/cli/serve/ServeApp.ts +15 -3
- package/src/cli/serve/web/components/DraftTabs.tsx +2 -1
- package/src/cli/serve/web/components/Gallery.tsx +2 -1
- package/src/cli/serve/web/components/HistoryPicker.tsx +5 -3
- package/src/cli/serve/web/components/MenuButton.tsx +2 -4
- package/src/cli/serve/web/components/Omnibox.tsx +2 -1
- package/src/cli/serve/web/components/PromptEnhancer.tsx +4 -3
- package/src/cli/serve/web/components/ShortcutsModal.tsx +2 -1
- package/src/cli/serve/web/components/SideMenu.tsx +2 -1
- package/src/cli/serve/web/components/controls/LorasControl.tsx +4 -3
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +2 -1
- package/src/cli/serve/web/components/controls/PromptControl.tsx +2 -1
- package/src/cli/serve/web/components/controls/SizeControl.tsx +2 -1
- package/src/cli/serve/web/state/escape.ts +16 -0
- package/src/coreExports.ts +10 -1
- package/src/vars/ComfyVars.ts +83 -13
- package/src/vars/DefinedWorkflow.ts +35 -2
- package/dist/run-serve-B5PfIuhK.js.map +0 -1
- package/dist/schemaDrift-BkN8rLiZ.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -16385,20 +16385,33 @@ declare class ToggleVar extends ComfyVar<boolean> {
|
|
|
16385
16385
|
}
|
|
16386
16386
|
/** how many options a choice holds: exactly one (the default), one or none, or any number */
|
|
16387
16387
|
type ChoiceSelect = 'one' | 'zero-or-one' | 'many';
|
|
16388
|
+
/** where a host-bound choice reads its options: one loader input of the host's live schema,
|
|
16389
|
+
* optionally narrowed (`v.model`) */
|
|
16390
|
+
type HostSlotSource = {
|
|
16391
|
+
slot: string;
|
|
16392
|
+
filter?: RegExp;
|
|
16393
|
+
};
|
|
16388
16394
|
declare class ChoiceVar<T extends string> extends ComfyVar<T> {
|
|
16389
|
-
readonly choices: readonly T[];
|
|
16390
16395
|
readonly kind: 'choice';
|
|
16391
16396
|
readonly select: 'one';
|
|
16392
|
-
|
|
16397
|
+
private list;
|
|
16398
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T, label?: string);
|
|
16399
|
+
get choices(): readonly T[];
|
|
16400
|
+
/** set for `v.model`: the loader input this choice lists */
|
|
16401
|
+
get hostSlot(): HostSlotSource | null;
|
|
16402
|
+
bindHost(host: LorasHost): void;
|
|
16393
16403
|
next(delta?: number): this;
|
|
16394
16404
|
parse(raw: string): boolean;
|
|
16395
16405
|
}
|
|
16396
16406
|
/** one option or none: `null` is "nothing picked", clicking the lit option clears it */
|
|
16397
16407
|
declare class OptionalChoiceVar<T extends string> extends ComfyVar<T | null> {
|
|
16398
|
-
readonly choices: readonly T[];
|
|
16399
16408
|
readonly kind: 'choice';
|
|
16400
16409
|
readonly select: 'zero-or-one';
|
|
16401
|
-
|
|
16410
|
+
private list;
|
|
16411
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T | null, label?: string);
|
|
16412
|
+
get choices(): readonly T[];
|
|
16413
|
+
get hostSlot(): HostSlotSource | null;
|
|
16414
|
+
bindHost(host: LorasHost): void;
|
|
16402
16415
|
/** pick `c`, or clear it when it is already the one picked */
|
|
16403
16416
|
toggle(c: T): this;
|
|
16404
16417
|
/** the TUI text form: a choice, or an empty line for none */
|
|
@@ -16435,6 +16448,22 @@ declare function choice<const T extends string>(choices: readonly T[], defaultVa
|
|
|
16435
16448
|
}): ChoiceVar<T>;
|
|
16436
16449
|
declare function choice<const T extends string>(choices: readonly T[], defaultValue: T | null, opts: ChoiceOpts<'zero-or-one'>): OptionalChoiceVar<T>;
|
|
16437
16450
|
declare function choice<const T extends string>(choices: readonly T[], defaultValue: readonly T[], opts: ChoiceOpts<'many'>): MultiChoiceVar<T>;
|
|
16451
|
+
type ModelVarOpts<T extends string> = {
|
|
16452
|
+
/** narrows the host's list: `/krea/i` */
|
|
16453
|
+
filter?: RegExp;
|
|
16454
|
+
label?: string;
|
|
16455
|
+
/** a file name, or null for "the workflow decides" (the build then reads null) */
|
|
16456
|
+
default: T | null;
|
|
16457
|
+
};
|
|
16458
|
+
/** a choice over the host's LIVE file list for one loader input (`'UNETLoader.unet_name'`),
|
|
16459
|
+
* resolved at define time and rebound by serve's refresh-schema: a downloaded model is picked
|
|
16460
|
+
* in the draft, never written into the workflow file */
|
|
16461
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
16462
|
+
default: T;
|
|
16463
|
+
}): ChoiceVar<T>;
|
|
16464
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
16465
|
+
default: null;
|
|
16466
|
+
}): OptionalChoiceVar<T>;
|
|
16438
16467
|
type ActiveLora<T extends string> = {
|
|
16439
16468
|
lora_name: T;
|
|
16440
16469
|
strength_model: number;
|
|
@@ -16449,6 +16478,7 @@ type LorasHost = {
|
|
|
16449
16478
|
};
|
|
16450
16479
|
schema: {
|
|
16451
16480
|
getLoras(filter?: RegExp): string[];
|
|
16481
|
+
stringValues(slot: string): string[];
|
|
16452
16482
|
};
|
|
16453
16483
|
};
|
|
16454
16484
|
/**
|
|
@@ -16615,7 +16645,7 @@ declare class VideoVar extends MediaVar {
|
|
|
16615
16645
|
readonly kind: 'video';
|
|
16616
16646
|
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadVideo'>>;
|
|
16617
16647
|
}
|
|
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 */
|
|
16648
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.model / v.loras / v.size / v.image / v.audio / v.video */
|
|
16619
16649
|
declare const v: {
|
|
16620
16650
|
text: (defaultValue: string, opts?: TextVarOpts | string) => TextVar;
|
|
16621
16651
|
prompt: (
|
|
@@ -16650,6 +16680,8 @@ declare const v: {
|
|
|
16650
16680
|
label?: string;
|
|
16651
16681
|
image?: ImageVar;
|
|
16652
16682
|
}) => SizeVar;
|
|
16683
|
+
/** host-bound: only inside defineWorkflow({ vars: (v) => … }), typed per slot there */
|
|
16684
|
+
model: typeof model;
|
|
16653
16685
|
image: (defaultValue: string, opts?: MediaVarOpts) => ImageVar;
|
|
16654
16686
|
audio: (defaultValue: string, opts?: MediaVarOpts) => AudioVar;
|
|
16655
16687
|
video: (defaultValue: string, opts?: MediaVarOpts) => VideoVar;
|
|
@@ -16692,10 +16724,26 @@ type LoraNameOf<ID extends string> = 'E_LoraName' extends keyof SdkForHost<ID>['
|
|
|
16692
16724
|
* the `v` handed to a vars LAMBDA: the global factory, host-typed —
|
|
16693
16725
|
* `v.loras(regex)` yields the host's lora-name union (resolved via bindHost)
|
|
16694
16726
|
*/
|
|
16695
|
-
type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
16727
|
+
type BoundVars<ID extends string> = Omit<typeof v, 'loras' | 'model'> & {
|
|
16696
16728
|
loras(options: RegExp, initial?: LorasInput<LoraNameOf<ID>>, label?: string): LorasVar<LoraNameOf<ID>>;
|
|
16697
16729
|
loras<T extends string>(options: readonly T[], initial?: LorasInput<T>, label?: string): LorasVar<T>;
|
|
16730
|
+
/** the host's file list for one loader input: the slot autocompletes, the value is its union */
|
|
16731
|
+
model: ModelFactory<SdkForHost<ID>['Slots']>;
|
|
16698
16732
|
};
|
|
16733
|
+
/** `v.model` typed by a host's slot table S (`Slots`): its own interface, so the host id's
|
|
16734
|
+
* variance stays measurable (inlined into BoundVars, ComfyHost<ID> stopped being a ComfyHost<string>) */
|
|
16735
|
+
interface ModelFactory<S> {
|
|
16736
|
+
<K extends keyof S & string>(slot: K, opts: ModelVarOpts<S[K] & string> & {
|
|
16737
|
+
default: S[K] & string;
|
|
16738
|
+
}): ChoiceVar<S[K] & string>;
|
|
16739
|
+
<K extends keyof S & string>(slot: K, opts: ModelVarOpts<S[K] & string> & {
|
|
16740
|
+
default: null;
|
|
16741
|
+
}): OptionalChoiceVar<S[K] & string>;
|
|
16742
|
+
}
|
|
16743
|
+
/** every `Node.input` slot of the host's generated sdk (any string without one) */
|
|
16744
|
+
type SlotNameOf<ID extends string> = keyof SdkForHost<ID>['Slots'] & string;
|
|
16745
|
+
/** the value union of one slot, strings only (a loader file list) */
|
|
16746
|
+
type SlotValueOf<ID extends string, K extends string> = K extends keyof SdkForHost<ID>['Slots'] ? SdkForHost<ID>['Slots'][K] & string : string;
|
|
16699
16747
|
type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
16700
16748
|
/** short id; also names the workflow instances */
|
|
16701
16749
|
id?: string;
|
|
@@ -17999,5 +18047,5 @@ declare function promptEnhancerPresets(): VarPresetSpec;
|
|
|
17999
18047
|
//#region src/cli/tui-env.d.ts
|
|
18000
18048
|
declare function isTuiActive(): boolean;
|
|
18001
18049
|
//#endregion
|
|
18002
|
-
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, 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 ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptEnhancer, 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, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
18050
|
+
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 HostSlotSource, 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, type ModelVarOpts, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptEnhancer, 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, type SlotNameOf, type SlotValueOf, 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, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
18003
18051
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -16385,20 +16385,33 @@ declare class ToggleVar extends ComfyVar<boolean> {
|
|
|
16385
16385
|
}
|
|
16386
16386
|
/** how many options a choice holds: exactly one (the default), one or none, or any number */
|
|
16387
16387
|
type ChoiceSelect = 'one' | 'zero-or-one' | 'many';
|
|
16388
|
+
/** where a host-bound choice reads its options: one loader input of the host's live schema,
|
|
16389
|
+
* optionally narrowed (`v.model`) */
|
|
16390
|
+
type HostSlotSource = {
|
|
16391
|
+
slot: string;
|
|
16392
|
+
filter?: RegExp;
|
|
16393
|
+
};
|
|
16388
16394
|
declare class ChoiceVar<T extends string> extends ComfyVar<T> {
|
|
16389
|
-
readonly choices: readonly T[];
|
|
16390
16395
|
readonly kind: 'choice';
|
|
16391
16396
|
readonly select: 'one';
|
|
16392
|
-
|
|
16397
|
+
private list;
|
|
16398
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T, label?: string);
|
|
16399
|
+
get choices(): readonly T[];
|
|
16400
|
+
/** set for `v.model`: the loader input this choice lists */
|
|
16401
|
+
get hostSlot(): HostSlotSource | null;
|
|
16402
|
+
bindHost(host: LorasHost): void;
|
|
16393
16403
|
next(delta?: number): this;
|
|
16394
16404
|
parse(raw: string): boolean;
|
|
16395
16405
|
}
|
|
16396
16406
|
/** one option or none: `null` is "nothing picked", clicking the lit option clears it */
|
|
16397
16407
|
declare class OptionalChoiceVar<T extends string> extends ComfyVar<T | null> {
|
|
16398
|
-
readonly choices: readonly T[];
|
|
16399
16408
|
readonly kind: 'choice';
|
|
16400
16409
|
readonly select: 'zero-or-one';
|
|
16401
|
-
|
|
16410
|
+
private list;
|
|
16411
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T | null, label?: string);
|
|
16412
|
+
get choices(): readonly T[];
|
|
16413
|
+
get hostSlot(): HostSlotSource | null;
|
|
16414
|
+
bindHost(host: LorasHost): void;
|
|
16402
16415
|
/** pick `c`, or clear it when it is already the one picked */
|
|
16403
16416
|
toggle(c: T): this;
|
|
16404
16417
|
/** the TUI text form: a choice, or an empty line for none */
|
|
@@ -16435,6 +16448,22 @@ declare function choice<const T extends string>(choices: readonly T[], defaultVa
|
|
|
16435
16448
|
}): ChoiceVar<T>;
|
|
16436
16449
|
declare function choice<const T extends string>(choices: readonly T[], defaultValue: T | null, opts: ChoiceOpts<'zero-or-one'>): OptionalChoiceVar<T>;
|
|
16437
16450
|
declare function choice<const T extends string>(choices: readonly T[], defaultValue: readonly T[], opts: ChoiceOpts<'many'>): MultiChoiceVar<T>;
|
|
16451
|
+
type ModelVarOpts<T extends string> = {
|
|
16452
|
+
/** narrows the host's list: `/krea/i` */
|
|
16453
|
+
filter?: RegExp;
|
|
16454
|
+
label?: string;
|
|
16455
|
+
/** a file name, or null for "the workflow decides" (the build then reads null) */
|
|
16456
|
+
default: T | null;
|
|
16457
|
+
};
|
|
16458
|
+
/** a choice over the host's LIVE file list for one loader input (`'UNETLoader.unet_name'`),
|
|
16459
|
+
* resolved at define time and rebound by serve's refresh-schema: a downloaded model is picked
|
|
16460
|
+
* in the draft, never written into the workflow file */
|
|
16461
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
16462
|
+
default: T;
|
|
16463
|
+
}): ChoiceVar<T>;
|
|
16464
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
16465
|
+
default: null;
|
|
16466
|
+
}): OptionalChoiceVar<T>;
|
|
16438
16467
|
type ActiveLora<T extends string> = {
|
|
16439
16468
|
lora_name: T;
|
|
16440
16469
|
strength_model: number;
|
|
@@ -16449,6 +16478,7 @@ type LorasHost = {
|
|
|
16449
16478
|
};
|
|
16450
16479
|
schema: {
|
|
16451
16480
|
getLoras(filter?: RegExp): string[];
|
|
16481
|
+
stringValues(slot: string): string[];
|
|
16452
16482
|
};
|
|
16453
16483
|
};
|
|
16454
16484
|
/**
|
|
@@ -16615,7 +16645,7 @@ declare class VideoVar extends MediaVar {
|
|
|
16615
16645
|
readonly kind: 'video';
|
|
16616
16646
|
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadVideo'>>;
|
|
16617
16647
|
}
|
|
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 */
|
|
16648
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.model / v.loras / v.size / v.image / v.audio / v.video */
|
|
16619
16649
|
declare const v: {
|
|
16620
16650
|
text: (defaultValue: string, opts?: TextVarOpts | string) => TextVar;
|
|
16621
16651
|
prompt: (
|
|
@@ -16650,6 +16680,8 @@ declare const v: {
|
|
|
16650
16680
|
label?: string;
|
|
16651
16681
|
image?: ImageVar;
|
|
16652
16682
|
}) => SizeVar;
|
|
16683
|
+
/** host-bound: only inside defineWorkflow({ vars: (v) => … }), typed per slot there */
|
|
16684
|
+
model: typeof model;
|
|
16653
16685
|
image: (defaultValue: string, opts?: MediaVarOpts) => ImageVar;
|
|
16654
16686
|
audio: (defaultValue: string, opts?: MediaVarOpts) => AudioVar;
|
|
16655
16687
|
video: (defaultValue: string, opts?: MediaVarOpts) => VideoVar;
|
|
@@ -16692,10 +16724,26 @@ type LoraNameOf<ID extends string> = 'E_LoraName' extends keyof SdkForHost<ID>['
|
|
|
16692
16724
|
* the `v` handed to a vars LAMBDA: the global factory, host-typed —
|
|
16693
16725
|
* `v.loras(regex)` yields the host's lora-name union (resolved via bindHost)
|
|
16694
16726
|
*/
|
|
16695
|
-
type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
16727
|
+
type BoundVars<ID extends string> = Omit<typeof v, 'loras' | 'model'> & {
|
|
16696
16728
|
loras(options: RegExp, initial?: LorasInput<LoraNameOf<ID>>, label?: string): LorasVar<LoraNameOf<ID>>;
|
|
16697
16729
|
loras<T extends string>(options: readonly T[], initial?: LorasInput<T>, label?: string): LorasVar<T>;
|
|
16730
|
+
/** the host's file list for one loader input: the slot autocompletes, the value is its union */
|
|
16731
|
+
model: ModelFactory<SdkForHost<ID>['Slots']>;
|
|
16698
16732
|
};
|
|
16733
|
+
/** `v.model` typed by a host's slot table S (`Slots`): its own interface, so the host id's
|
|
16734
|
+
* variance stays measurable (inlined into BoundVars, ComfyHost<ID> stopped being a ComfyHost<string>) */
|
|
16735
|
+
interface ModelFactory<S> {
|
|
16736
|
+
<K extends keyof S & string>(slot: K, opts: ModelVarOpts<S[K] & string> & {
|
|
16737
|
+
default: S[K] & string;
|
|
16738
|
+
}): ChoiceVar<S[K] & string>;
|
|
16739
|
+
<K extends keyof S & string>(slot: K, opts: ModelVarOpts<S[K] & string> & {
|
|
16740
|
+
default: null;
|
|
16741
|
+
}): OptionalChoiceVar<S[K] & string>;
|
|
16742
|
+
}
|
|
16743
|
+
/** every `Node.input` slot of the host's generated sdk (any string without one) */
|
|
16744
|
+
type SlotNameOf<ID extends string> = keyof SdkForHost<ID>['Slots'] & string;
|
|
16745
|
+
/** the value union of one slot, strings only (a loader file list) */
|
|
16746
|
+
type SlotValueOf<ID extends string, K extends string> = K extends keyof SdkForHost<ID>['Slots'] ? SdkForHost<ID>['Slots'][K] & string : string;
|
|
16699
16747
|
type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
16700
16748
|
/** short id; also names the workflow instances */
|
|
16701
16749
|
id?: string;
|
|
@@ -17999,5 +18047,5 @@ declare function promptEnhancerPresets(): VarPresetSpec;
|
|
|
17999
18047
|
//#region src/cli/tui-env.d.ts
|
|
18000
18048
|
declare function isTuiActive(): boolean;
|
|
18001
18049
|
//#endregion
|
|
18002
|
-
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, 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 ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptEnhancer, 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, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
18050
|
+
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 HostSlotSource, 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, type ModelVarOpts, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptEnhancer, 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, type SlotNameOf, type SlotValueOf, 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, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
18003
18051
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ function createNodeStorage() {
|
|
|
110
110
|
}
|
|
111
111
|
//#endregion
|
|
112
112
|
//#region package.json
|
|
113
|
-
var version = "2.
|
|
113
|
+
var version = "2.16.0";
|
|
114
114
|
//#endregion
|
|
115
115
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
116
116
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -5022,12 +5022,46 @@ var ToggleVar = class extends ComfyVar {
|
|
|
5022
5022
|
return this.value ? "ON" : "OFF";
|
|
5023
5023
|
}
|
|
5024
5024
|
};
|
|
5025
|
+
/** a fixed list, or the host's list for one slot once bindHost ran */
|
|
5026
|
+
var ChoiceList = class {
|
|
5027
|
+
constructor(source) {
|
|
5028
|
+
this.source = source;
|
|
5029
|
+
this.resolved = null;
|
|
5030
|
+
}
|
|
5031
|
+
get slot() {
|
|
5032
|
+
return isChoiceList(this.source) ? null : this.source;
|
|
5033
|
+
}
|
|
5034
|
+
get choices() {
|
|
5035
|
+
if (isChoiceList(this.source)) return this.source;
|
|
5036
|
+
if (this.resolved == null) throw new Error(`v.model('${this.source.slot}') is host-bound — it only works inside defineWorkflow({ vars }) (pass a name list to v.choice otherwise)`);
|
|
5037
|
+
return this.resolved;
|
|
5038
|
+
}
|
|
5039
|
+
/** cast: whitelist family 1 (agent/coding.md) — stringValues() returns the runtime values of
|
|
5040
|
+
* the SAME object_info enum the generated slot union comes from */
|
|
5041
|
+
bind(host) {
|
|
5042
|
+
const src = this.slot;
|
|
5043
|
+
if (src == null) return;
|
|
5044
|
+
const all = host.schema.stringValues(src.slot);
|
|
5045
|
+
const filter = src.filter == null ? null : statelessRegex(src.filter);
|
|
5046
|
+
this.resolved = filter == null ? all : all.filter((n) => filter.test(n));
|
|
5047
|
+
}
|
|
5048
|
+
};
|
|
5025
5049
|
var ChoiceVar = class extends ComfyVar {
|
|
5026
5050
|
constructor(choices, defaultValue, label) {
|
|
5027
5051
|
super(defaultValue, label);
|
|
5028
|
-
this.choices = choices;
|
|
5029
5052
|
this.kind = "choice";
|
|
5030
5053
|
this.select = "one";
|
|
5054
|
+
this.list = new ChoiceList(choices);
|
|
5055
|
+
}
|
|
5056
|
+
get choices() {
|
|
5057
|
+
return this.list.choices;
|
|
5058
|
+
}
|
|
5059
|
+
/** set for `v.model`: the loader input this choice lists */
|
|
5060
|
+
get hostSlot() {
|
|
5061
|
+
return this.list.slot;
|
|
5062
|
+
}
|
|
5063
|
+
bindHost(host) {
|
|
5064
|
+
this.list.bind(host);
|
|
5031
5065
|
}
|
|
5032
5066
|
next(delta = 1) {
|
|
5033
5067
|
const nextIx = (this.choices.indexOf(this.value) + delta + this.choices.length) % this.choices.length;
|
|
@@ -5044,9 +5078,18 @@ var ChoiceVar = class extends ComfyVar {
|
|
|
5044
5078
|
var OptionalChoiceVar = class extends ComfyVar {
|
|
5045
5079
|
constructor(choices, defaultValue, label) {
|
|
5046
5080
|
super(defaultValue, label);
|
|
5047
|
-
this.choices = choices;
|
|
5048
5081
|
this.kind = "choice";
|
|
5049
5082
|
this.select = "zero-or-one";
|
|
5083
|
+
this.list = new ChoiceList(choices);
|
|
5084
|
+
}
|
|
5085
|
+
get choices() {
|
|
5086
|
+
return this.list.choices;
|
|
5087
|
+
}
|
|
5088
|
+
get hostSlot() {
|
|
5089
|
+
return this.list.slot;
|
|
5090
|
+
}
|
|
5091
|
+
bindHost(host) {
|
|
5092
|
+
this.list.bind(host);
|
|
5050
5093
|
}
|
|
5051
5094
|
/** pick `c`, or clear it when it is already the one picked */
|
|
5052
5095
|
toggle(c) {
|
|
@@ -5124,6 +5167,14 @@ function choice(choices, defaultValue, opts) {
|
|
|
5124
5167
|
if (defaultValue == null) throw new Error("a 'one' choice needs a default: use { select: 'zero-or-one' } for none");
|
|
5125
5168
|
return new ChoiceVar(choices, defaultValue, o.label);
|
|
5126
5169
|
}
|
|
5170
|
+
function model(slot, opts) {
|
|
5171
|
+
const source = {
|
|
5172
|
+
slot,
|
|
5173
|
+
filter: opts.filter
|
|
5174
|
+
};
|
|
5175
|
+
if (opts.default == null) return new OptionalChoiceVar(source, null, opts.label);
|
|
5176
|
+
return new ChoiceVar(source, opts.default, opts.label);
|
|
5177
|
+
}
|
|
5127
5178
|
/** normalize a loras record into what a standard LoraLoader chain consumes */
|
|
5128
5179
|
function activeLoras(loras) {
|
|
5129
5180
|
const out = [];
|
|
@@ -5538,7 +5589,7 @@ var VideoVar = class extends MediaVar {
|
|
|
5538
5589
|
return await this.loadVia(wf);
|
|
5539
5590
|
}
|
|
5540
5591
|
};
|
|
5541
|
-
/** 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 */
|
|
5592
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.model / v.loras / v.size / v.image / v.audio / v.video */
|
|
5542
5593
|
const v = {
|
|
5543
5594
|
text: (defaultValue, opts = {}) => new TextVar(defaultValue, typeof opts === "string" ? { label: opts } : opts),
|
|
5544
5595
|
prompt: (defaultValue, opts = {}) => new PromptVar(defaultValue, opts),
|
|
@@ -5553,6 +5604,8 @@ const v = {
|
|
|
5553
5604
|
choice,
|
|
5554
5605
|
loras: (options, initial = {}, label) => new LorasVar(options, initial, label),
|
|
5555
5606
|
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets ?? sizePresetsFor(defaultValue), opts.label, opts.image, opts.starred),
|
|
5607
|
+
/** host-bound: only inside defineWorkflow({ vars: (v) => … }), typed per slot there */
|
|
5608
|
+
model,
|
|
5556
5609
|
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts),
|
|
5557
5610
|
audio: (defaultValue, opts = {}) => new AudioVar(defaultValue, opts),
|
|
5558
5611
|
video: (defaultValue, opts = {}) => new VideoVar(defaultValue, opts)
|