comfy-ts 2.20.2 → 2.22.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 +17 -1
- package/dist/{ServeApp-B469W26E.js → ServeApp-DuxYdaZZ.js} +142 -7
- package/dist/ServeApp-DuxYdaZZ.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{exampleAssets-yBLaKXLq.js → exampleAssets-1NHndnNB.js} +59 -17
- package/dist/exampleAssets-1NHndnNB.js.map +1 -0
- package/dist/{findDefinedWorkflow-B90-xFxX.js → findDefinedWorkflow-CRsBTTJK.js} +2 -2
- package/dist/{findDefinedWorkflow-B90-xFxX.js.map → findDefinedWorkflow-CRsBTTJK.js.map} +1 -1
- package/dist/index.cjs +118 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -9
- package/dist/index.d.ts +90 -9
- package/dist/index.js +117 -20
- package/dist/index.js.map +1 -1
- package/dist/{run-run-C-dDD9Dc.js → run-run-Y5ZI48vV.js} +5 -5
- package/dist/{run-run-C-dDD9Dc.js.map → run-run-Y5ZI48vV.js.map} +1 -1
- package/dist/{run-serve-CsEYPGm9.js → run-serve-CICU_wTL.js} +4 -4
- package/dist/{run-serve-CsEYPGm9.js.map → run-serve-CICU_wTL.js.map} +1 -1
- package/dist/{run-tui-bsmja4hi.js → run-tui-CViJXsHL.js} +4 -4
- package/dist/{run-tui-bsmja4hi.js.map → run-tui-CViJXsHL.js.map} +1 -1
- package/dist/{schemaDrift-DaWsE-mt.js → schemaDrift-CzjaIwZX.js} +53 -20
- package/dist/schemaDrift-CzjaIwZX.js.map +1 -0
- package/dist/serve-web.js +204 -47
- package/dist/web.d.ts +90 -9
- package/dist/web.js +117 -20
- package/dist/web.js.map +1 -1
- package/examples/README.md +2 -0
- package/examples/depth-explorer/models.ts +722 -0
- package/examples/depth-explorer/serve.ts +140 -0
- package/examples/depth-explorer/thumbs/bae.webp +0 -0
- package/examples/depth-explorer/thumbs/da3-mono-large.webp +0 -0
- package/examples/depth-explorer/thumbs/dav1-vitl.webp +0 -0
- package/examples/depth-explorer/thumbs/dav2-vitl.webp +0 -0
- package/examples/depth-explorer/thumbs/dsine.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-albedo.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-metalness.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-roughness.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-shading.webp +0 -0
- package/examples/depth-explorer/thumbs/iid-specular.webp +0 -0
- package/examples/depth-explorer/thumbs/leres.webp +0 -0
- package/examples/depth-explorer/thumbs/lotus-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/marigold2-albedo.webp +0 -0
- package/examples/depth-explorer/thumbs/marigold2-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/marigold2-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/metric3d-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/metric3d-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/midas-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/midas.webp +0 -0
- package/examples/depth-explorer/thumbs/moge2-depth.webp +0 -0
- package/examples/depth-explorer/thumbs/moge2-normal.webp +0 -0
- package/examples/depth-explorer/thumbs/zoe-da.webp +0 -0
- package/examples/depth-explorer/thumbs/zoe.webp +0 -0
- package/examples/depth-explorer/web/App.tsx +457 -0
- package/examples/depth-explorer/web/gl.ts +202 -0
- package/examples/depth-explorer/web/index.html +14 -0
- package/examples/depth-explorer/web/main.tsx +19 -0
- package/examples/depth-explorer/web/pixels.ts +86 -0
- package/examples/depth-explorer/web/state.ts +329 -0
- package/examples/depth-explorer/web/styles.css +366 -0
- package/examples/depth-explorer/web/tsconfig.json +16 -0
- package/examples/rvion/17-relight.cflow.ts +110 -0
- package/package.json +3 -2
- package/src/cli/serve/ServeApp.ts +79 -4
- package/src/cli/serve/describeVar.ts +12 -1
- package/src/cli/serve/resultHistory.ts +6 -1
- package/src/cli/serve/thumbs.ts +66 -0
- package/src/cli/serve/web/api.ts +5 -1
- package/src/cli/serve/web/components/Gallery.tsx +2 -0
- package/src/cli/serve/web/components/controls/BasicControls.tsx +14 -17
- package/src/cli/serve/web/components/controls/MediaControl.tsx +62 -9
- package/src/cli/serve/web/components/controls/RichSelect.tsx +262 -0
- package/src/cli/serve/web/state/RunSt.poll.test.ts +4 -1
- package/src/cli/serve/web/state/choiceButtons.ts +26 -2
- package/src/cli/serve/web/styles.ts +39 -0
- package/src/cli/serve/web/widgets/OutputWidgets.tsx +19 -0
- package/src/cli/serve/web/widgets/RelightSt.ts +113 -0
- package/src/cli/serve/web/widgets/RelightWidget.tsx +305 -0
- package/src/cli/serve/web/widgets/relightGl.ts +305 -0
- package/src/cli/serve/web/widgets/widgetStyles.ts +19 -0
- package/src/coreExports.ts +9 -0
- package/src/host/ComfyHost.ts +21 -0
- package/src/host/leastBusy.ts +37 -0
- package/src/state.ts +6 -0
- package/src/vars/ComfyVars.ts +32 -2
- package/src/vars/DefinedWorkflow.ts +42 -21
- package/src/vars/outputWidgets.ts +47 -0
- package/dist/ServeApp-B469W26E.js.map +0 -1
- package/dist/exampleAssets-yBLaKXLq.js.map +0 -1
- package/dist/schemaDrift-DaWsE-mt.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -16925,6 +16925,41 @@ type LoraLanes<T extends string = string> = {
|
|
|
16925
16925
|
* lanes object can never be mistaken for each other */
|
|
16926
16926
|
type LorasInput<T extends string = string> = LoraRecord<T> | LoraLanes<T>;
|
|
16927
16927
|
//#endregion
|
|
16928
|
+
//#region src/vars/outputWidgets.d.ts
|
|
16929
|
+
/** the maps a relight widget reads, each the tag of one output image */
|
|
16930
|
+
type RelightRoles = {
|
|
16931
|
+
/** the photo itself; the base colour when no albedo is given */
|
|
16932
|
+
image: string;
|
|
16933
|
+
/** near = white; places each pixel in 3D and casts the shadows */
|
|
16934
|
+
depth?: string;
|
|
16935
|
+
/** OpenGL convention (green up) */
|
|
16936
|
+
normal?: string;
|
|
16937
|
+
albedo?: string;
|
|
16938
|
+
/** white = rough */
|
|
16939
|
+
roughness?: string;
|
|
16940
|
+
/** white = metal */
|
|
16941
|
+
metalness?: string;
|
|
16942
|
+
/** the non diffuse part of the light (reflections, highlights) */
|
|
16943
|
+
specular?: string;
|
|
16944
|
+
};
|
|
16945
|
+
type RelightWidget = {
|
|
16946
|
+
kind: 'relight';
|
|
16947
|
+
title?: string;
|
|
16948
|
+
roles: RelightRoles;
|
|
16949
|
+
};
|
|
16950
|
+
type OutputWidget = RelightWidget;
|
|
16951
|
+
type OutputWidgetKind = OutputWidget['kind'];
|
|
16952
|
+
declare const widget: {
|
|
16953
|
+
/** a point light moved over the image in 3D: left/right, up/down, nearer/farther */
|
|
16954
|
+
relight(roles: RelightRoles, opts?: {
|
|
16955
|
+
title?: string;
|
|
16956
|
+
}): RelightWidget;
|
|
16957
|
+
};
|
|
16958
|
+
/** the roles of a widget whose tag one of the images carries, as role → index in `images` */
|
|
16959
|
+
declare function resolveWidgetRoles(w: OutputWidget, images: {
|
|
16960
|
+
tags?: string[];
|
|
16961
|
+
}[]): Map<string, number>;
|
|
16962
|
+
//#endregion
|
|
16928
16963
|
//#region src/vars/presets.d.ts
|
|
16929
16964
|
type VarPreset = {
|
|
16930
16965
|
label: string;
|
|
@@ -16957,6 +16992,27 @@ type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice
|
|
|
16957
16992
|
*/
|
|
16958
16993
|
/** how a var LOOKS in the panel, set by the workflow: `v.int(8).ui({ icon, color, description })`.
|
|
16959
16994
|
* Every slot is optional, a color is any css color */
|
|
16995
|
+
/** how one option of a choice var looks in the panel. Every field is optional: a bare option
|
|
16996
|
+
* shows its value */
|
|
16997
|
+
type ChoiceOptionLook = {
|
|
16998
|
+
/** a 24×24 svg path drawn in the color, or a whole `<svg …>` string */
|
|
16999
|
+
icon?: string;
|
|
17000
|
+
color?: string;
|
|
17001
|
+
/** the name shown instead of the raw value (the value stays the payload) */
|
|
17002
|
+
label?: string;
|
|
17003
|
+
description?: string;
|
|
17004
|
+
/** a picture: an http(s) url, or a local path relative to the workflow file */
|
|
17005
|
+
thumb?: string;
|
|
17006
|
+
/** when it came out: `2025`, `2025-11` */
|
|
17007
|
+
date?: string;
|
|
17008
|
+
/** what it weighs on disk: `1.3 GB` */
|
|
17009
|
+
size?: string;
|
|
17010
|
+
/** 1 (rough) to 5 (the best of its kind) */
|
|
17011
|
+
quality?: number;
|
|
17012
|
+
/** how long it takes: `0.9 s`, `30 s` */
|
|
17013
|
+
speed?: string;
|
|
17014
|
+
tags?: string[];
|
|
17015
|
+
};
|
|
16960
17016
|
type VarUi = {
|
|
16961
17017
|
/** shown as a (?) after the label, the text is its tooltip */
|
|
16962
17018
|
description?: string;
|
|
@@ -16973,11 +17029,8 @@ type VarUi = {
|
|
|
16973
17029
|
groupColor?: string;
|
|
16974
17030
|
border?: string;
|
|
16975
17031
|
/** choice vars: a look per option, keyed by the option value. The lit option is filled
|
|
16976
|
-
* with its own color */
|
|
16977
|
-
options?: Record<string,
|
|
16978
|
-
icon?: string;
|
|
16979
|
-
color?: string;
|
|
16980
|
-
}>;
|
|
17032
|
+
* with its own color; a dropdown row shows the rest (ChoiceOptionLook) */
|
|
17033
|
+
options?: Record<string, ChoiceOptionLook>;
|
|
16981
17034
|
/** the field is shown but disabled unless every named var holds one of the listed values:
|
|
16982
17035
|
* `{ model: ['aesthetic', 'base'] }`. Checked against the var names when the workflow loads.
|
|
16983
17036
|
* Display only: a disabled var's value still reaches the build */
|
|
@@ -17380,6 +17433,10 @@ type MediaVarOpts = {
|
|
|
17380
17433
|
/** the text var a file's `<name>.txt` sidecar fills, when a driver sets this var from a file
|
|
17381
17434
|
* and leaves that one unset: a voice clip's transcript (`comfy-ts run`) */
|
|
17382
17435
|
sidecarText?: TextVar;
|
|
17436
|
+
/** one-click starting files: `{ 'a lioness': exampleImagePath(…), 'a ruin': 'https://…' }`.
|
|
17437
|
+
* A local path that is not on this machine is shown disabled, a url is fetched when a run
|
|
17438
|
+
* uses it. Key order is display order */
|
|
17439
|
+
presets?: Record<string, string>;
|
|
17383
17440
|
};
|
|
17384
17441
|
type ImageVarOpts = MediaVarOpts;
|
|
17385
17442
|
type AudioVarOpts = MediaVarOpts;
|
|
@@ -17411,6 +17468,11 @@ declare abstract class MediaVar extends ComfyVar<string> {
|
|
|
17411
17468
|
constructor(defaultValue: string, opts?: MediaVarOpts);
|
|
17412
17469
|
/** what the picker lists (lowercase, no dots) */
|
|
17413
17470
|
get extensions(): readonly string[];
|
|
17471
|
+
/** the one-click starting files, `~/` expanded, in their declared order */
|
|
17472
|
+
get presets(): {
|
|
17473
|
+
label: string;
|
|
17474
|
+
value: string;
|
|
17475
|
+
}[];
|
|
17414
17476
|
set(value: string): this;
|
|
17415
17477
|
parse(raw: string): boolean;
|
|
17416
17478
|
isSet(): boolean;
|
|
@@ -17559,6 +17621,9 @@ type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
|
17559
17621
|
/** free search tags for the serve omnibox, added to the ones read from the graph
|
|
17560
17622
|
* (`image`, `audio`, `video`, `text`, `llm`, `edit`) */
|
|
17561
17623
|
tags?: string[];
|
|
17624
|
+
/** built-in web panel widgets drawn over a run's outputs (`widget.relight(...)`), each role
|
|
17625
|
+
* naming the `tag` of a save node. The CLI and the TUI ignore them */
|
|
17626
|
+
widgets?: OutputWidget[];
|
|
17562
17627
|
};
|
|
17563
17628
|
/**
|
|
17564
17629
|
* a re-runnable workflow definition: `build` re-executes per run with the
|
|
@@ -17588,17 +17653,22 @@ declare class DefinedWorkflow<ID extends string = string, V extends VarsSpec = V
|
|
|
17588
17653
|
* the graph is built against (TUI host override): node/model availability
|
|
17589
17654
|
* there surfaces as workflow.problems / server validation, by design.
|
|
17590
17655
|
* `p.dry` builds a graph only to read it: nothing is uploaded, lastWorkflow is left alone.
|
|
17656
|
+
* `p.values` builds from a snapshot taken earlier (run() takes it at the call).
|
|
17591
17657
|
*/
|
|
17592
17658
|
build(p?: {
|
|
17593
17659
|
advance?: boolean;
|
|
17594
|
-
host?: ComfyHost
|
|
17660
|
+
host?: ComfyHost;
|
|
17595
17661
|
dry?: boolean;
|
|
17662
|
+
values?: VarValues<V>;
|
|
17596
17663
|
}): Promise<ComfyWorkflow<ID>>;
|
|
17597
|
-
/**
|
|
17664
|
+
/** the current var values; `advance` then moves each var to its next run (the seed) */
|
|
17665
|
+
private snapshot;
|
|
17666
|
+
/** build a fresh graph from the var values AT THE CALL, send it, wait for outputs:
|
|
17667
|
+
* set a var, call run(), set it again, and each run keeps its own values.
|
|
17598
17668
|
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
17599
17669
|
* `settings.host` runs against THAT host instead of the defining one. */
|
|
17600
17670
|
run(settings?: RunSettings & {
|
|
17601
|
-
host?: ComfyHost
|
|
17671
|
+
host?: ComfyHost;
|
|
17602
17672
|
}): Promise<ComfyExecution>;
|
|
17603
17673
|
}
|
|
17604
17674
|
//#endregion
|
|
@@ -17847,6 +17917,13 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
17847
17917
|
* `'none'` (ComfyUI's default) means no live preview frame will ever arrive; null = the host
|
|
17848
17918
|
* does not publish its launch flags (a cloud host), so only a run can tell */
|
|
17849
17919
|
fetchPreviewMethod: () => Promise<PreviewMethod | null>;
|
|
17920
|
+
/** jobs waiting or running on this host, every client counted (`GET /prompt`) */
|
|
17921
|
+
fetchQueueSize: (p?: {
|
|
17922
|
+
timeoutMs?: number;
|
|
17923
|
+
}) => Promise<number>;
|
|
17924
|
+
/** runs started through DefinedWorkflow.run() and not finished yet: counted from the call,
|
|
17925
|
+
* before the prompt reaches the server queue, so runs started together spread out */
|
|
17926
|
+
runsInFlight: number;
|
|
17850
17927
|
/** the server's recent console buffer (entries are write CHUNKS, not lines) */
|
|
17851
17928
|
fetchRawLogs: () => Promise<{
|
|
17852
17929
|
entries: LogEntry[];
|
|
@@ -18488,6 +18565,10 @@ declare class ComfyTS {
|
|
|
18488
18565
|
host<const ID extends string>(data: ComfyHostData & {
|
|
18489
18566
|
id: ID;
|
|
18490
18567
|
}): ComfyHost<ID>;
|
|
18568
|
+
/** the host with the shortest queue, for `wf.run({ host: await comfy.leastBusy([a, b]) })` */
|
|
18569
|
+
leastBusy<H extends ComfyHost<string>>(hosts: readonly H[], p?: {
|
|
18570
|
+
timeoutMs?: number;
|
|
18571
|
+
}): Promise<H>;
|
|
18491
18572
|
/**
|
|
18492
18573
|
* A ComfyRegistry instance that provides access to all
|
|
18493
18574
|
* known Comfy nodes, models, plugins, ...
|
|
@@ -18885,5 +18966,5 @@ declare function promptEnhancerPresets(): VarPresetSpec;
|
|
|
18885
18966
|
//#region src/cli/tui-env.d.ts
|
|
18886
18967
|
declare function isTuiActive(): boolean;
|
|
18887
18968
|
//#endregion
|
|
18888
|
-
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 ExecutionPreview, 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 PreviewMethod, 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 };
|
|
18969
|
+
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 ChoiceOptionLook, 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 ExecutionPreview, 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 OutputWidget, type OutputWidgetKind, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type PreviewMethod, 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 RelightRoles, type RelightWidget, 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, resolveWidgetRoles, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v, widget };
|
|
18889
18970
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -16925,6 +16925,41 @@ type LoraLanes<T extends string = string> = {
|
|
|
16925
16925
|
* lanes object can never be mistaken for each other */
|
|
16926
16926
|
type LorasInput<T extends string = string> = LoraRecord<T> | LoraLanes<T>;
|
|
16927
16927
|
//#endregion
|
|
16928
|
+
//#region src/vars/outputWidgets.d.ts
|
|
16929
|
+
/** the maps a relight widget reads, each the tag of one output image */
|
|
16930
|
+
type RelightRoles = {
|
|
16931
|
+
/** the photo itself; the base colour when no albedo is given */
|
|
16932
|
+
image: string;
|
|
16933
|
+
/** near = white; places each pixel in 3D and casts the shadows */
|
|
16934
|
+
depth?: string;
|
|
16935
|
+
/** OpenGL convention (green up) */
|
|
16936
|
+
normal?: string;
|
|
16937
|
+
albedo?: string;
|
|
16938
|
+
/** white = rough */
|
|
16939
|
+
roughness?: string;
|
|
16940
|
+
/** white = metal */
|
|
16941
|
+
metalness?: string;
|
|
16942
|
+
/** the non diffuse part of the light (reflections, highlights) */
|
|
16943
|
+
specular?: string;
|
|
16944
|
+
};
|
|
16945
|
+
type RelightWidget = {
|
|
16946
|
+
kind: 'relight';
|
|
16947
|
+
title?: string;
|
|
16948
|
+
roles: RelightRoles;
|
|
16949
|
+
};
|
|
16950
|
+
type OutputWidget = RelightWidget;
|
|
16951
|
+
type OutputWidgetKind = OutputWidget['kind'];
|
|
16952
|
+
declare const widget: {
|
|
16953
|
+
/** a point light moved over the image in 3D: left/right, up/down, nearer/farther */
|
|
16954
|
+
relight(roles: RelightRoles, opts?: {
|
|
16955
|
+
title?: string;
|
|
16956
|
+
}): RelightWidget;
|
|
16957
|
+
};
|
|
16958
|
+
/** the roles of a widget whose tag one of the images carries, as role → index in `images` */
|
|
16959
|
+
declare function resolveWidgetRoles(w: OutputWidget, images: {
|
|
16960
|
+
tags?: string[];
|
|
16961
|
+
}[]): Map<string, number>;
|
|
16962
|
+
//#endregion
|
|
16928
16963
|
//#region src/vars/presets.d.ts
|
|
16929
16964
|
type VarPreset = {
|
|
16930
16965
|
label: string;
|
|
@@ -16957,6 +16992,27 @@ type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice
|
|
|
16957
16992
|
*/
|
|
16958
16993
|
/** how a var LOOKS in the panel, set by the workflow: `v.int(8).ui({ icon, color, description })`.
|
|
16959
16994
|
* Every slot is optional, a color is any css color */
|
|
16995
|
+
/** how one option of a choice var looks in the panel. Every field is optional: a bare option
|
|
16996
|
+
* shows its value */
|
|
16997
|
+
type ChoiceOptionLook = {
|
|
16998
|
+
/** a 24×24 svg path drawn in the color, or a whole `<svg …>` string */
|
|
16999
|
+
icon?: string;
|
|
17000
|
+
color?: string;
|
|
17001
|
+
/** the name shown instead of the raw value (the value stays the payload) */
|
|
17002
|
+
label?: string;
|
|
17003
|
+
description?: string;
|
|
17004
|
+
/** a picture: an http(s) url, or a local path relative to the workflow file */
|
|
17005
|
+
thumb?: string;
|
|
17006
|
+
/** when it came out: `2025`, `2025-11` */
|
|
17007
|
+
date?: string;
|
|
17008
|
+
/** what it weighs on disk: `1.3 GB` */
|
|
17009
|
+
size?: string;
|
|
17010
|
+
/** 1 (rough) to 5 (the best of its kind) */
|
|
17011
|
+
quality?: number;
|
|
17012
|
+
/** how long it takes: `0.9 s`, `30 s` */
|
|
17013
|
+
speed?: string;
|
|
17014
|
+
tags?: string[];
|
|
17015
|
+
};
|
|
16960
17016
|
type VarUi = {
|
|
16961
17017
|
/** shown as a (?) after the label, the text is its tooltip */
|
|
16962
17018
|
description?: string;
|
|
@@ -16973,11 +17029,8 @@ type VarUi = {
|
|
|
16973
17029
|
groupColor?: string;
|
|
16974
17030
|
border?: string;
|
|
16975
17031
|
/** choice vars: a look per option, keyed by the option value. The lit option is filled
|
|
16976
|
-
* with its own color */
|
|
16977
|
-
options?: Record<string,
|
|
16978
|
-
icon?: string;
|
|
16979
|
-
color?: string;
|
|
16980
|
-
}>;
|
|
17032
|
+
* with its own color; a dropdown row shows the rest (ChoiceOptionLook) */
|
|
17033
|
+
options?: Record<string, ChoiceOptionLook>;
|
|
16981
17034
|
/** the field is shown but disabled unless every named var holds one of the listed values:
|
|
16982
17035
|
* `{ model: ['aesthetic', 'base'] }`. Checked against the var names when the workflow loads.
|
|
16983
17036
|
* Display only: a disabled var's value still reaches the build */
|
|
@@ -17380,6 +17433,10 @@ type MediaVarOpts = {
|
|
|
17380
17433
|
/** the text var a file's `<name>.txt` sidecar fills, when a driver sets this var from a file
|
|
17381
17434
|
* and leaves that one unset: a voice clip's transcript (`comfy-ts run`) */
|
|
17382
17435
|
sidecarText?: TextVar;
|
|
17436
|
+
/** one-click starting files: `{ 'a lioness': exampleImagePath(…), 'a ruin': 'https://…' }`.
|
|
17437
|
+
* A local path that is not on this machine is shown disabled, a url is fetched when a run
|
|
17438
|
+
* uses it. Key order is display order */
|
|
17439
|
+
presets?: Record<string, string>;
|
|
17383
17440
|
};
|
|
17384
17441
|
type ImageVarOpts = MediaVarOpts;
|
|
17385
17442
|
type AudioVarOpts = MediaVarOpts;
|
|
@@ -17411,6 +17468,11 @@ declare abstract class MediaVar extends ComfyVar<string> {
|
|
|
17411
17468
|
constructor(defaultValue: string, opts?: MediaVarOpts);
|
|
17412
17469
|
/** what the picker lists (lowercase, no dots) */
|
|
17413
17470
|
get extensions(): readonly string[];
|
|
17471
|
+
/** the one-click starting files, `~/` expanded, in their declared order */
|
|
17472
|
+
get presets(): {
|
|
17473
|
+
label: string;
|
|
17474
|
+
value: string;
|
|
17475
|
+
}[];
|
|
17414
17476
|
set(value: string): this;
|
|
17415
17477
|
parse(raw: string): boolean;
|
|
17416
17478
|
isSet(): boolean;
|
|
@@ -17559,6 +17621,9 @@ type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
|
17559
17621
|
/** free search tags for the serve omnibox, added to the ones read from the graph
|
|
17560
17622
|
* (`image`, `audio`, `video`, `text`, `llm`, `edit`) */
|
|
17561
17623
|
tags?: string[];
|
|
17624
|
+
/** built-in web panel widgets drawn over a run's outputs (`widget.relight(...)`), each role
|
|
17625
|
+
* naming the `tag` of a save node. The CLI and the TUI ignore them */
|
|
17626
|
+
widgets?: OutputWidget[];
|
|
17562
17627
|
};
|
|
17563
17628
|
/**
|
|
17564
17629
|
* a re-runnable workflow definition: `build` re-executes per run with the
|
|
@@ -17588,17 +17653,22 @@ declare class DefinedWorkflow<ID extends string = string, V extends VarsSpec = V
|
|
|
17588
17653
|
* the graph is built against (TUI host override): node/model availability
|
|
17589
17654
|
* there surfaces as workflow.problems / server validation, by design.
|
|
17590
17655
|
* `p.dry` builds a graph only to read it: nothing is uploaded, lastWorkflow is left alone.
|
|
17656
|
+
* `p.values` builds from a snapshot taken earlier (run() takes it at the call).
|
|
17591
17657
|
*/
|
|
17592
17658
|
build(p?: {
|
|
17593
17659
|
advance?: boolean;
|
|
17594
|
-
host?: ComfyHost
|
|
17660
|
+
host?: ComfyHost;
|
|
17595
17661
|
dry?: boolean;
|
|
17662
|
+
values?: VarValues<V>;
|
|
17596
17663
|
}): Promise<ComfyWorkflow<ID>>;
|
|
17597
|
-
/**
|
|
17664
|
+
/** the current var values; `advance` then moves each var to its next run (the seed) */
|
|
17665
|
+
private snapshot;
|
|
17666
|
+
/** build a fresh graph from the var values AT THE CALL, send it, wait for outputs:
|
|
17667
|
+
* set a var, call run(), set it again, and each run keeps its own values.
|
|
17598
17668
|
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
17599
17669
|
* `settings.host` runs against THAT host instead of the defining one. */
|
|
17600
17670
|
run(settings?: RunSettings & {
|
|
17601
|
-
host?: ComfyHost
|
|
17671
|
+
host?: ComfyHost;
|
|
17602
17672
|
}): Promise<ComfyExecution>;
|
|
17603
17673
|
}
|
|
17604
17674
|
//#endregion
|
|
@@ -17847,6 +17917,13 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
17847
17917
|
* `'none'` (ComfyUI's default) means no live preview frame will ever arrive; null = the host
|
|
17848
17918
|
* does not publish its launch flags (a cloud host), so only a run can tell */
|
|
17849
17919
|
fetchPreviewMethod: () => Promise<PreviewMethod | null>;
|
|
17920
|
+
/** jobs waiting or running on this host, every client counted (`GET /prompt`) */
|
|
17921
|
+
fetchQueueSize: (p?: {
|
|
17922
|
+
timeoutMs?: number;
|
|
17923
|
+
}) => Promise<number>;
|
|
17924
|
+
/** runs started through DefinedWorkflow.run() and not finished yet: counted from the call,
|
|
17925
|
+
* before the prompt reaches the server queue, so runs started together spread out */
|
|
17926
|
+
runsInFlight: number;
|
|
17850
17927
|
/** the server's recent console buffer (entries are write CHUNKS, not lines) */
|
|
17851
17928
|
fetchRawLogs: () => Promise<{
|
|
17852
17929
|
entries: LogEntry[];
|
|
@@ -18488,6 +18565,10 @@ declare class ComfyTS {
|
|
|
18488
18565
|
host<const ID extends string>(data: ComfyHostData & {
|
|
18489
18566
|
id: ID;
|
|
18490
18567
|
}): ComfyHost<ID>;
|
|
18568
|
+
/** the host with the shortest queue, for `wf.run({ host: await comfy.leastBusy([a, b]) })` */
|
|
18569
|
+
leastBusy<H extends ComfyHost<string>>(hosts: readonly H[], p?: {
|
|
18570
|
+
timeoutMs?: number;
|
|
18571
|
+
}): Promise<H>;
|
|
18491
18572
|
/**
|
|
18492
18573
|
* A ComfyRegistry instance that provides access to all
|
|
18493
18574
|
* known Comfy nodes, models, plugins, ...
|
|
@@ -18885,5 +18966,5 @@ declare function promptEnhancerPresets(): VarPresetSpec;
|
|
|
18885
18966
|
//#region src/cli/tui-env.d.ts
|
|
18886
18967
|
declare function isTuiActive(): boolean;
|
|
18887
18968
|
//#endregion
|
|
18888
|
-
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 ExecutionPreview, 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 PreviewMethod, 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 };
|
|
18969
|
+
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 ChoiceOptionLook, 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 ExecutionPreview, 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 OutputWidget, type OutputWidgetKind, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type PreviewMethod, 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 RelightRoles, type RelightWidget, 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, resolveWidgetRoles, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v, widget };
|
|
18889
18970
|
//# 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.22.0";
|
|
114
114
|
//#endregion
|
|
115
115
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
116
116
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -6531,6 +6531,13 @@ var MediaVar = class extends ComfyVar {
|
|
|
6531
6531
|
get extensions() {
|
|
6532
6532
|
return this.opts.extensions ?? DEFAULT_MEDIA_EXTENSIONS[this.kind];
|
|
6533
6533
|
}
|
|
6534
|
+
/** the one-click starting files, `~/` expanded, in their declared order */
|
|
6535
|
+
get presets() {
|
|
6536
|
+
return Object.entries(this.opts.presets ?? {}).map(([label, value]) => ({
|
|
6537
|
+
label,
|
|
6538
|
+
value: expandUserPath(value)
|
|
6539
|
+
}));
|
|
6540
|
+
}
|
|
6534
6541
|
set(value) {
|
|
6535
6542
|
return super.set(expandUserPath(value));
|
|
6536
6543
|
}
|
|
@@ -6693,37 +6700,50 @@ var DefinedWorkflow = class {
|
|
|
6693
6700
|
* the graph is built against (TUI host override): node/model availability
|
|
6694
6701
|
* there surfaces as workflow.problems / server validation, by design.
|
|
6695
6702
|
* `p.dry` builds a graph only to read it: nothing is uploaded, lastWorkflow is left alone.
|
|
6703
|
+
* `p.values` builds from a snapshot taken earlier (run() takes it at the call).
|
|
6696
6704
|
*/
|
|
6697
6705
|
async build(p = {}) {
|
|
6698
6706
|
const wf = (p.host ?? this.host).workflow({ id: this.spec.id });
|
|
6699
6707
|
wf.dry = p.dry === true;
|
|
6700
|
-
const values =
|
|
6701
|
-
if (p.advance) for (const varDef of Object.values(this.vars)) varDef.afterRun();
|
|
6708
|
+
const values = p.values ?? this.snapshot({ advance: p.advance === true });
|
|
6702
6709
|
await this.spec.build(wf.builder, values, wf);
|
|
6703
6710
|
if (wf.dry) return wf;
|
|
6704
6711
|
this.lastWorkflow = wf;
|
|
6705
6712
|
return wf;
|
|
6706
6713
|
}
|
|
6707
|
-
/**
|
|
6714
|
+
/** the current var values; `advance` then moves each var to its next run (the seed) */
|
|
6715
|
+
snapshot(p) {
|
|
6716
|
+
const values = varValues(this.vars);
|
|
6717
|
+
if (p.advance) for (const varDef of Object.values(this.vars)) varDef.afterRun();
|
|
6718
|
+
return values;
|
|
6719
|
+
}
|
|
6720
|
+
/** build a fresh graph from the var values AT THE CALL, send it, wait for outputs:
|
|
6721
|
+
* set a var, call run(), set it again, and each run keeps its own values.
|
|
6708
6722
|
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
6709
6723
|
* `settings.host` runs against THAT host instead of the defining one. */
|
|
6710
6724
|
async run(settings = {}) {
|
|
6711
6725
|
const host = settings.host ?? this.host;
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
host
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6726
|
+
const values = this.snapshot({ advance: true });
|
|
6727
|
+
host.runsInFlight++;
|
|
6728
|
+
try {
|
|
6729
|
+
await host.connect();
|
|
6730
|
+
const execution = await (await this.build({
|
|
6731
|
+
host,
|
|
6732
|
+
values
|
|
6733
|
+
})).run({
|
|
6734
|
+
save: settings.save,
|
|
6735
|
+
ephemeral: settings.ephemeral,
|
|
6736
|
+
scrubHistory: settings.scrubHistory,
|
|
6737
|
+
idMode: settings.idMode,
|
|
6738
|
+
log: settings.log,
|
|
6739
|
+
onProgress: settings.onProgress,
|
|
6740
|
+
onPreview: settings.onPreview
|
|
6741
|
+
});
|
|
6742
|
+
this.lastExecution = execution;
|
|
6743
|
+
return execution;
|
|
6744
|
+
} finally {
|
|
6745
|
+
host.runsInFlight--;
|
|
6746
|
+
}
|
|
6727
6747
|
}
|
|
6728
6748
|
};
|
|
6729
6749
|
//#endregion
|
|
@@ -7035,6 +7055,14 @@ var ComfyHost = class {
|
|
|
7035
7055
|
if (!res.ok) throw new Error(`GET /system_stats failed: ${res.status}`);
|
|
7036
7056
|
return previewMethodFromSystemStats(await res.json());
|
|
7037
7057
|
};
|
|
7058
|
+
this.fetchQueueSize = async (p = {}) => {
|
|
7059
|
+
const res = await this.fetch("/prompt", { signal: AbortSignal.timeout(p.timeoutMs ?? 3e3) });
|
|
7060
|
+
if (!res.ok) throw new Error(`GET /prompt failed: ${res.status}`);
|
|
7061
|
+
const size = queueRemainingOf(await res.json());
|
|
7062
|
+
if (size == null) throw new Error(`GET /prompt: no exec_info.queue_remaining in the reply`);
|
|
7063
|
+
return size;
|
|
7064
|
+
};
|
|
7065
|
+
this.runsInFlight = 0;
|
|
7038
7066
|
this.fetchRawLogs = async () => {
|
|
7039
7067
|
const res = await this.fetch("/internal/logs/raw", {}, { apiPrefix: false });
|
|
7040
7068
|
if (!res.ok) throw new Error(`GET /internal/logs/raw failed: ${res.status}`);
|
|
@@ -7433,6 +7461,49 @@ var ComfyHost = class {
|
|
|
7433
7461
|
}
|
|
7434
7462
|
}
|
|
7435
7463
|
};
|
|
7464
|
+
/** `exec_info.queue_remaining` of a `GET /prompt` reply, null when the shape is not there */
|
|
7465
|
+
function queueRemainingOf(json) {
|
|
7466
|
+
if (typeof json !== "object" || json == null || !("exec_info" in json)) return null;
|
|
7467
|
+
const info = json.exec_info;
|
|
7468
|
+
if (typeof info !== "object" || info == null || !("queue_remaining" in info)) return null;
|
|
7469
|
+
return typeof info.queue_remaining === "number" ? info.queue_remaining : null;
|
|
7470
|
+
}
|
|
7471
|
+
//#endregion
|
|
7472
|
+
//#region src/host/leastBusy.ts
|
|
7473
|
+
/**
|
|
7474
|
+
* the host with the shortest queue. Score = max(server queue, our runs in flight there):
|
|
7475
|
+
* the server counts every client, the local count sees runs not posted yet.
|
|
7476
|
+
* Ties go to the first host listed; a host that does not answer is skipped, all down throws.
|
|
7477
|
+
*/
|
|
7478
|
+
async function leastBusy(hosts, p = {}) {
|
|
7479
|
+
if (hosts.length === 0) throw new Error("leastBusy: no host given");
|
|
7480
|
+
const probes = await Promise.all(hosts.map(async (host) => {
|
|
7481
|
+
try {
|
|
7482
|
+
const queue = await host.fetchQueueSize({ timeoutMs: p.timeoutMs });
|
|
7483
|
+
return {
|
|
7484
|
+
host,
|
|
7485
|
+
score: Math.max(queue, host.runsInFlight),
|
|
7486
|
+
error: null
|
|
7487
|
+
};
|
|
7488
|
+
} catch (err) {
|
|
7489
|
+
return {
|
|
7490
|
+
host,
|
|
7491
|
+
score: Infinity,
|
|
7492
|
+
error: extractErrorMessage(err)
|
|
7493
|
+
};
|
|
7494
|
+
}
|
|
7495
|
+
}));
|
|
7496
|
+
let best = null;
|
|
7497
|
+
for (const probe of probes) {
|
|
7498
|
+
if (probe.error != null) {
|
|
7499
|
+
console.warn(`🟡 leastBusy: host '${probe.host.data.id}' skipped: ${probe.error}`);
|
|
7500
|
+
continue;
|
|
7501
|
+
}
|
|
7502
|
+
if (best == null || probe.score < best.score) best = probe;
|
|
7503
|
+
}
|
|
7504
|
+
if (best == null) throw new Error(`🔴 leastBusy: no host answered (${probes.map((x) => `'${x.host.data.id}': ${x.error}`).join(", ")})`);
|
|
7505
|
+
return best.host;
|
|
7506
|
+
}
|
|
7436
7507
|
//#endregion
|
|
7437
7508
|
//#region src/utils/downloadFile.ts
|
|
7438
7509
|
async function downloadFile(url, outputPath, logPrefix = " - ") {
|
|
@@ -8049,6 +8120,10 @@ var ComfyTS = class ComfyTS {
|
|
|
8049
8120
|
this.hosts.set(data.id, created);
|
|
8050
8121
|
return created;
|
|
8051
8122
|
}
|
|
8123
|
+
/** the host with the shortest queue, for `wf.run({ host: await comfy.leastBusy([a, b]) })` */
|
|
8124
|
+
leastBusy(hosts, p = {}) {
|
|
8125
|
+
return leastBusy(hosts, p);
|
|
8126
|
+
}
|
|
8052
8127
|
get registry() {
|
|
8053
8128
|
if (this._registry == null) this._registry = new ComfyRegistry({
|
|
8054
8129
|
check: false,
|
|
@@ -8091,6 +8166,28 @@ var ComfyTS = class ComfyTS {
|
|
|
8091
8166
|
}
|
|
8092
8167
|
};
|
|
8093
8168
|
//#endregion
|
|
8169
|
+
//#region src/vars/outputWidgets.ts
|
|
8170
|
+
const widget = {
|
|
8171
|
+
/** a point light moved over the image in 3D: left/right, up/down, nearer/farther */
|
|
8172
|
+
relight(roles, opts = {}) {
|
|
8173
|
+
if (roles.depth == null && roles.normal == null) throw new Error("widget.relight needs a `depth` or a `normal` role: without either there is no surface to light");
|
|
8174
|
+
return {
|
|
8175
|
+
kind: "relight",
|
|
8176
|
+
roles,
|
|
8177
|
+
...opts.title != null ? { title: opts.title } : {}
|
|
8178
|
+
};
|
|
8179
|
+
} };
|
|
8180
|
+
/** the roles of a widget whose tag one of the images carries, as role → index in `images` */
|
|
8181
|
+
function resolveWidgetRoles(w, images) {
|
|
8182
|
+
const out = /* @__PURE__ */ new Map();
|
|
8183
|
+
for (const [role, tag] of Object.entries(w.roles)) {
|
|
8184
|
+
if (typeof tag !== "string") continue;
|
|
8185
|
+
const ix = images.findIndex((img) => img.tags?.includes(tag) === true);
|
|
8186
|
+
if (ix >= 0) out.set(role, ix);
|
|
8187
|
+
}
|
|
8188
|
+
return out;
|
|
8189
|
+
}
|
|
8190
|
+
//#endregion
|
|
8094
8191
|
//#region src/utils/loraTag.ts
|
|
8095
8192
|
/**
|
|
8096
8193
|
* build a LoraManager-style lora tag: `<lora:name:strength>` or
|
|
@@ -8221,6 +8318,6 @@ function isTuiActive() {
|
|
|
8221
8318
|
*/
|
|
8222
8319
|
setDefaultComfyStorage(createNodeStorage());
|
|
8223
8320
|
//#endregion
|
|
8224
|
-
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, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
8321
|
+
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, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resolveWidgetRoles, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v, widget };
|
|
8225
8322
|
|
|
8226
8323
|
//# sourceMappingURL=index.js.map
|