comfy-ts 2.3.0 → 2.4.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 +13 -0
- package/dist/{DefinedWorkflow-CwHInZgn.js → DefinedWorkflow-QrhT6V66.js} +441 -9
- package/dist/DefinedWorkflow-QrhT6V66.js.map +1 -0
- package/dist/{DraftsSt-omWuBSej.js → DraftsSt-D9Fhk4qR.js} +2 -2
- package/dist/{DraftsSt-omWuBSej.js.map → DraftsSt-D9Fhk4qR.js.map} +1 -1
- package/dist/cli.js +116 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +260 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -9
- package/dist/index.d.ts +132 -9
- package/dist/index.js +249 -24
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-CfzOH-AR.js → run-serve-C9E8dyLP.js} +3 -3
- package/dist/run-serve-C9E8dyLP.js.map +1 -0
- package/dist/{run-tui-_LD0DoGe.js → run-tui-cawSJuuh.js} +60 -121
- package/dist/run-tui-cawSJuuh.js.map +1 -0
- package/dist/{state-C-OOEcp3.js → state-BbKuSDCV.js} +7 -76
- package/dist/state-BbKuSDCV.js.map +1 -0
- package/dist/web.d.ts +132 -9
- package/dist/web.js +249 -24
- package/dist/web.js.map +1 -1
- package/guide-for-agents.md +3 -0
- package/package.json +2 -1
- package/src/cli/comfy-ts-cli.ts +16 -1
- package/src/cli/flags.ts +14 -0
- package/src/cli/gen.ts +2 -4
- package/src/cli/loras.ts +113 -0
- package/src/cli/serve/applyVarPayload.ts +1 -1
- package/src/cli/tui/components/LorasOverlay.tsx +18 -5
- package/src/cli/tui/components/StatusBar.tsx +1 -0
- package/src/cli/tui/components/TuiApp.tsx +1 -0
- package/src/cli/tui/imageClipboard.ts +3 -3
- package/src/cli/tui/protocolImagePainter.ts +1 -1
- package/src/cli/tui/run-tui.tsx +2 -2
- package/src/cli/tui/state/ExecSt.ts +2 -2
- package/src/cli/tui/state/HostSt.ts +1 -1
- package/src/cli/tui/state/LorasSt.ts +60 -15
- package/src/cli/tui/state/PreviewSt.ts +1 -1
- package/src/cli/tui/state/SettingsSt.ts +1 -1
- package/src/coreExports.ts +20 -1
- package/src/host/ComfyHost.ts +1 -1
- package/src/host/loraInfoCache.ts +216 -0
- package/src/host/loraManagerApi.ts +131 -27
- package/src/runner/ComfyExecution.ts +1 -1
- package/src/runner/outputPath.ts +3 -3
- package/src/utils/isRecord.ts +4 -0
- package/src/vars/ComfyVars.ts +13 -7
- package/src/vars/loraKeywords.ts +48 -5
- package/dist/DefinedWorkflow-CwHInZgn.js.map +0 -1
- package/dist/run-serve-CfzOH-AR.js.map +0 -1
- package/dist/run-tui-_LD0DoGe.js.map +0 -1
- package/dist/state-C-OOEcp3.js.map +0 -1
package/dist/web.d.ts
CHANGED
|
@@ -12719,7 +12719,7 @@ declare class ComfyExecution {
|
|
|
12719
12719
|
retrieveImage: (comfyImageInfo: ComfyImageInfo, promptNodeID: ComfyNodeId) => Promise<void>;
|
|
12720
12720
|
/** re-encode when asked, then write under OUR local naming — never the raw
|
|
12721
12721
|
* server filename: a cloud host resets its _00001_ counter per run, so the
|
|
12722
|
-
* server name overwrote the same local file on every run
|
|
12722
|
+
* server name overwrote the same local file on every run */
|
|
12723
12723
|
private encodeAndWrite;
|
|
12724
12724
|
/** accumulate an output on the prompt; tags from node metadata ride along */
|
|
12725
12725
|
private pushImage;
|
|
@@ -15910,8 +15910,8 @@ declare class ResilientWebSocketClient {
|
|
|
15910
15910
|
* the var's CLASS, and the only safe way to discriminate one: `instanceof` compares class
|
|
15911
15911
|
* OBJECTS, and the published package hands the same class out twice — a consumer's
|
|
15912
15912
|
* `.cflow.ts` imports `comfy-ts` (dist/index.js) while `comfy-ts serve`/`tui` run from the
|
|
15913
|
-
* cli bundle, so every `instanceof XVar` across that boundary is false (
|
|
15914
|
-
*
|
|
15913
|
+
* cli bundle, so every `instanceof XVar` across that boundary is false (observed
|
|
15914
|
+
* in a consumer app: "var 'prompt' has unsupported kind 'text'", for EVERY kind). A string tag
|
|
15915
15915
|
* crosses bundles; a class identity does not.
|
|
15916
15916
|
*/
|
|
15917
15917
|
type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' | 'image';
|
|
@@ -15957,9 +15957,13 @@ declare class TextVar extends ComfyVar<string> {
|
|
|
15957
15957
|
readonly kind: 'text';
|
|
15958
15958
|
parse(raw: string): boolean;
|
|
15959
15959
|
}
|
|
15960
|
-
/** what PromptVar needs from a loras var: covariant face, so LorasVar<'a'|'b'> fits
|
|
15960
|
+
/** what PromptVar needs from a loras var: covariant face, so LorasVar<'a'|'b'> fits.
|
|
15961
|
+
* `hostId` scopes the keyword lookup: the same file name on two hosts is often a
|
|
15962
|
+
* different model, and injecting the other host's trigger words is a silently
|
|
15963
|
+
* wrong generation. */
|
|
15961
15964
|
type ActiveLoraSource = {
|
|
15962
15965
|
activeNames(): string[];
|
|
15966
|
+
hostId?: string;
|
|
15963
15967
|
};
|
|
15964
15968
|
/** what a prompt CONTRIBUTES to build: `vars.prompt.positive` / `.negative` */
|
|
15965
15969
|
type PromptValue = {
|
|
@@ -16078,6 +16082,9 @@ type ActiveLora<T extends string> = {
|
|
|
16078
16082
|
declare function activeLoras<T extends string>(loras: Partial<Record<T, LoraStrength>>): ActiveLora<T>[];
|
|
16079
16083
|
/** what LorasVar.bindHost needs — structural, so ComfyVars never imports ComfyHost */
|
|
16080
16084
|
type LorasHost = {
|
|
16085
|
+
data?: {
|
|
16086
|
+
id?: string;
|
|
16087
|
+
};
|
|
16081
16088
|
schema: {
|
|
16082
16089
|
getLoras(filter?: RegExp): string[];
|
|
16083
16090
|
};
|
|
@@ -16095,6 +16102,8 @@ declare class LorasVar<T extends string> extends ComfyVar<Partial<Record<T, Lora
|
|
|
16095
16102
|
private prev;
|
|
16096
16103
|
/** a RegExp source resolves lazily (bindHost) — null until then */
|
|
16097
16104
|
private resolvedOptions;
|
|
16105
|
+
/** which host these loras live on, so their metadata is read from ITS mirror */
|
|
16106
|
+
hostId: string | undefined;
|
|
16098
16107
|
constructor(optionsSource: readonly T[] | RegExp, initial?: Partial<Record<T, LoraStrength>>, label?: string);
|
|
16099
16108
|
get options(): readonly T[];
|
|
16100
16109
|
/** DefinedWorkflow binds the host at define time: a RegExp source resolves here.
|
|
@@ -16129,7 +16138,7 @@ type SizePreset = {
|
|
|
16129
16138
|
/** SDXL-style ~1MP buckets, multiples of 64 — safe for most latent models */
|
|
16130
16139
|
declare const DEFAULT_SIZE_PRESETS: SizePreset[];
|
|
16131
16140
|
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
16132
|
-
* size of a linked image var (
|
|
16141
|
+
* size of a linked image var (the widget shows
|
|
16133
16142
|
* `WxH size of image '<name>'` as a pickable row) */
|
|
16134
16143
|
declare class SizeVar extends ComfyVar<SizeValue> {
|
|
16135
16144
|
readonly presets: SizePreset[];
|
|
@@ -17342,9 +17351,123 @@ workflow: CanonicalWorkflow, opts?: {
|
|
|
17342
17351
|
}) => ComfyApiJson;
|
|
17343
17352
|
//#endregion
|
|
17344
17353
|
//#region src/vars/loraKeywords.d.ts
|
|
17345
|
-
|
|
17346
|
-
|
|
17347
|
-
|
|
17354
|
+
/** the hand keyword when this lora HAS an entry (`''` included), else the mirror's trigger words */
|
|
17355
|
+
declare function getLoraKeyword(name: string, hostId?: string): string;
|
|
17356
|
+
/** true when the keyword shown comes from the lora-manager mirror, not from ⌃K */
|
|
17357
|
+
declare function isLoraKeywordFromMirror(name: string, hostId?: string): boolean;
|
|
17358
|
+
/** what `clearLoraKeywordOverride` would restore this lora to, `''` when nothing */
|
|
17359
|
+
declare function loraKeywordFromMirror(name: string, hostId?: string): string;
|
|
17360
|
+
/**
|
|
17361
|
+
* drop the hand entry entirely, so the mirror's trigger words apply again.
|
|
17362
|
+
* The way BACK from an empty-string tombstone: without it, clearing a keyword on
|
|
17363
|
+
* a lora that has trigger words was a one-way door only a text editor could undo.
|
|
17364
|
+
*/
|
|
17365
|
+
declare function clearLoraKeywordOverride(name: string): void;
|
|
17366
|
+
/**
|
|
17367
|
+
* empty keyword deletes the entry — EXCEPT when the mirror has trigger words for
|
|
17368
|
+
* this lora: there `''` is stored as an explicit tombstone, the only way to say
|
|
17369
|
+
* "inject nothing" about a lora civitai gave words to. Every set writes the file
|
|
17370
|
+
* (tiny, rare).
|
|
17371
|
+
*/
|
|
17372
|
+
declare function setLoraKeyword(name: string, keyword: string, hostId?: string): void;
|
|
17373
|
+
//#endregion
|
|
17374
|
+
//#region src/host/loraManagerApi.d.ts
|
|
17375
|
+
/**
|
|
17376
|
+
* client for the OPTIONAL ComfyUI-Lora-Manager extension.
|
|
17377
|
+
* absent extension = normal condition: callers get null/empty and degrade.
|
|
17378
|
+
*/
|
|
17379
|
+
/**
|
|
17380
|
+
* one lora exactly as lora-manager sent it. RAW on purpose (agent/architecture
|
|
17381
|
+
* item 8): the mirror on disk keeps every field, including the ones we do not
|
|
17382
|
+
* read yet, so adding `sha256` or `civitai.modelId` to a surface later is an
|
|
17383
|
+
* accessor, not a re-sync. Reading goes through the checked lm* helpers below.
|
|
17384
|
+
*/
|
|
17385
|
+
type LmLoraItem = Record<string, unknown>;
|
|
17386
|
+
/**
|
|
17387
|
+
* the ONE key space where a host's object_info spelling of a lora meets
|
|
17388
|
+
* lora-manager's: lowercase, forward slashes, no model extension.
|
|
17389
|
+
* `styles\Aurora.safetensors` and lm's folder `styles` + file_name `aurora`
|
|
17390
|
+
* both become `styles/aurora`.
|
|
17391
|
+
*/
|
|
17392
|
+
declare function loraKey(name: string): string;
|
|
17393
|
+
/**
|
|
17394
|
+
* the outcome of a sweep, DISCRIMINATED. A bare `null` for "no loras" conflated
|
|
17395
|
+
* three very different situations, and callers then told the user the wrong one:
|
|
17396
|
+
* a host that is merely DOWN was reported as "extension not detected", and a
|
|
17397
|
+
* sweep cut short mid-collection was indistinguishable from a complete one, so
|
|
17398
|
+
* a partial mirror could overwrite a good one and report success.
|
|
17399
|
+
*/
|
|
17400
|
+
type LoraSweep = {
|
|
17401
|
+
status: 'ok';
|
|
17402
|
+
items: LmLoraItem[];
|
|
17403
|
+
} |
|
|
17404
|
+
/** the extension answered, then stopped answering: `items` is INCOMPLETE, never write it over a good mirror */
|
|
17405
|
+
{
|
|
17406
|
+
status: 'partial';
|
|
17407
|
+
items: LmLoraItem[];
|
|
17408
|
+
reason: string;
|
|
17409
|
+
} |
|
|
17410
|
+
/** no ComfyUI-Lora-Manager on this host (404 on the first page) */
|
|
17411
|
+
{
|
|
17412
|
+
status: 'absent';
|
|
17413
|
+
} |
|
|
17414
|
+
/** the host itself could not be reached (down, refused, auth) */
|
|
17415
|
+
{
|
|
17416
|
+
status: 'unreachable';
|
|
17417
|
+
reason: string;
|
|
17418
|
+
};
|
|
17419
|
+
//#endregion
|
|
17420
|
+
//#region src/host/loraInfoCache.d.ts
|
|
17421
|
+
/**
|
|
17422
|
+
* the LOCAL MIRROR of what ComfyUI-Lora-Manager knows about a host's loras
|
|
17423
|
+
* (agent/architecture.md item 8). A ComfyUI host only ever tells us a lora's
|
|
17424
|
+
* file name; the model's real name, its trigger words and its tags live in the
|
|
17425
|
+
* extension. We sweep them once (`comfy-ts loras`) into
|
|
17426
|
+
* `.comfy-ts/hosts/<id>/loras.json` and every surface reads the mirror after.
|
|
17427
|
+
*/
|
|
17428
|
+
type LoraMirror = {
|
|
17429
|
+
hostId: string;
|
|
17430
|
+
/** remembered so a later `comfy-ts loras` re-syncs with no flags. NEVER an api key. */
|
|
17431
|
+
hostUrl: string;
|
|
17432
|
+
fetchedAt: string;
|
|
17433
|
+
count: number;
|
|
17434
|
+
/** `loraKey` → the RAW lm item */
|
|
17435
|
+
loras: Record<string, LmLoraItem>;
|
|
17436
|
+
};
|
|
17437
|
+
/**
|
|
17438
|
+
* forget everything loaded, so the next read picks up a fresh `comfy-ts loras`.
|
|
17439
|
+
* A long-lived process (the TUI, `comfy-ts serve`) has no other way to see a
|
|
17440
|
+
* re-sync that happened in another terminal.
|
|
17441
|
+
*/
|
|
17442
|
+
declare function reloadLoraInfoCache(): void;
|
|
17443
|
+
/**
|
|
17444
|
+
* the lm item for a raw lora name (`styles\x.safetensors`).
|
|
17445
|
+
* `hostId` picks the mirror that actually describes this host's file; without
|
|
17446
|
+
* it, any host that knows the name answers. null when unsynced/unknown.
|
|
17447
|
+
*/
|
|
17448
|
+
declare function getLoraInfo(name: string, hostId?: string): LmLoraItem | null;
|
|
17449
|
+
/** civitai trigger words for this lora, in civitai's order */
|
|
17450
|
+
declare function getLoraTriggerWords(name: string, hostId?: string): string[];
|
|
17451
|
+
/** the human name (`Aurora Ink Wash`), falling back to the file's own name */
|
|
17452
|
+
declare function getLoraDisplayName(name: string, hostId?: string): string;
|
|
17453
|
+
/** server-relative preview url from the mirror, null when unsynced/unknown */
|
|
17454
|
+
declare function getLoraPreviewUrl(name: string, hostId?: string): string | null;
|
|
17455
|
+
/** the lora's NAMES: the file, and the model name a human would call it by */
|
|
17456
|
+
declare function loraSearchNames(name: string, hostId?: string): string[];
|
|
17457
|
+
/** the lora's FREE TEXT: tags, base model, trigger words */
|
|
17458
|
+
declare function loraSearchText(name: string, hostId?: string): string[];
|
|
17459
|
+
/**
|
|
17460
|
+
* the loras overlay filter: find a lora by its human name, not only by the file
|
|
17461
|
+
* name. EVERY whitespace-separated token must be a SUBSTRING of some field — order
|
|
17462
|
+
* free, so `aurora ink`, `ink aurora` and `styles wash` all land on the same
|
|
17463
|
+
* lora. NOT fuzzyMatch: a subsequence match over phrases this long matches
|
|
17464
|
+
* nearly everything. Measured on a real collection, filtering by each lora's
|
|
17465
|
+
* own file name: this rule peaks at 8 hits where fuzzyMatch matched a third of
|
|
17466
|
+
* every lora present.
|
|
17467
|
+
* Fields are matched one by one, never as a concatenated haystack, for the same
|
|
17468
|
+
* reason. `tests/lora-corpus.private.test.ts` keeps that measurement runnable.
|
|
17469
|
+
*/
|
|
17470
|
+
declare function loraMatchesFilter(name: string, filter: string, hostId?: string): boolean;
|
|
17348
17471
|
//#endregion
|
|
17349
17472
|
//#region src/utils/loraTag.d.ts
|
|
17350
17473
|
/**
|
|
@@ -17356,5 +17479,5 @@ declare function setLoraKeyword(name: string, keyword: string): void;
|
|
|
17356
17479
|
*/
|
|
17357
17480
|
declare function loraTag<N extends string = string>(name: N, strength?: number, clipStrength?: number): string;
|
|
17358
17481
|
//#endregion
|
|
17359
|
-
export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyVar, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, ChoiceVar, type CodegenOptions, type ComfyApiJson, type ComfyApiNodeJson, 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 ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LoraNameOf, type LoraStrength, type LorasHost, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, type NodeMode, NodeOf, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptID, type PromptRelated_WsMsg, type PromptValue, PromptVar, type QualifiedNodeKey, RelativePath, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, Tagged, TextVar, ToggleVar, type VarKind, type VarValues, type VarsSpec, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraKeyword, hostIdToNamespace, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
17482
|
+
export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyVar, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, ChoiceVar, type CodegenOptions, type ComfyApiJson, type ComfyApiNodeJson, 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 ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LmLoraItem, type LoraMirror, type LoraNameOf, type LoraStrength, type LoraSweep, type LorasHost, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, type NodeMode, NodeOf, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptID, type PromptRelated_WsMsg, type PromptValue, PromptVar, type QualifiedNodeKey, RelativePath, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, Tagged, TextVar, ToggleVar, type VarKind, type VarValues, type VarsSpec, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, 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, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
17360
17483
|
//# 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.4.0";
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
107
107
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -733,7 +733,7 @@ const ComfyDefaultNodeWhenUnknown_Schema = {
|
|
|
733
733
|
};
|
|
734
734
|
//#endregion
|
|
735
735
|
//#region src/sdk-generator/inputWidgetKind.ts
|
|
736
|
-
const isRecord = (x) => typeof x === "object" && x != null && !Array.isArray(x);
|
|
736
|
+
const isRecord$1 = (x) => typeof x === "object" && x != null && !Array.isArray(x);
|
|
737
737
|
/**
|
|
738
738
|
* seed phantom: a TRUTHY `control_after_generate` adds one consumed value.
|
|
739
739
|
* The frontend creates the control widget on truthiness, and real 2026 hosts
|
|
@@ -750,7 +750,7 @@ const flattenInputSections = (inputs) => {
|
|
|
750
750
|
const out = [];
|
|
751
751
|
for (const section of ["required", "optional"]) {
|
|
752
752
|
const sec = inputs[section];
|
|
753
|
-
if (!isRecord(sec)) continue;
|
|
753
|
+
if (!isRecord$1(sec)) continue;
|
|
754
754
|
for (const [name, spec] of Object.entries(sec)) {
|
|
755
755
|
if (!Array.isArray(spec) || spec.length === 0) continue;
|
|
756
756
|
const t = spec[0];
|
|
@@ -770,10 +770,10 @@ const parseDynamicOptions = (options) => {
|
|
|
770
770
|
if (options.length === 0) return null;
|
|
771
771
|
const out = [];
|
|
772
772
|
for (const entry of options) {
|
|
773
|
-
if (!isRecord(entry)) return null;
|
|
773
|
+
if (!isRecord$1(entry)) return null;
|
|
774
774
|
const key = entry["key"];
|
|
775
775
|
const inputs = entry["inputs"];
|
|
776
|
-
if (typeof key !== "string" || !isRecord(inputs)) return null;
|
|
776
|
+
if (typeof key !== "string" || !isRecord$1(inputs)) return null;
|
|
777
777
|
out.push({
|
|
778
778
|
key,
|
|
779
779
|
inputs: flattenInputSections(inputs)
|
|
@@ -797,7 +797,7 @@ const parseContainer = (template) => {
|
|
|
797
797
|
return {
|
|
798
798
|
kind: "dynamic-container",
|
|
799
799
|
instanceNames: names,
|
|
800
|
-
requiredCount: isRecord(input) && isRecord(input["required"]) && Object.keys(input["required"]).length > 0 ? Math.min(min, names.length) : 0
|
|
800
|
+
requiredCount: isRecord$1(input) && isRecord$1(input["required"]) && Object.keys(input["required"]).length > 0 ? Math.min(min, names.length) : 0
|
|
801
801
|
};
|
|
802
802
|
};
|
|
803
803
|
/**
|
|
@@ -808,8 +808,8 @@ const parseContainer = (template) => {
|
|
|
808
808
|
* typed instance keys and the container stays builderBase territory.
|
|
809
809
|
*/
|
|
810
810
|
const containerInstanceSlotType = (opts) => {
|
|
811
|
-
const template = (isRecord(opts) ? opts : null)?.["template"];
|
|
812
|
-
if (!isRecord(template) || !isRecord(template["input"])) return null;
|
|
811
|
+
const template = (isRecord$1(opts) ? opts : null)?.["template"];
|
|
812
|
+
if (!isRecord$1(template) || !isRecord$1(template["input"])) return null;
|
|
813
813
|
const subs = flattenInputSections(template["input"]);
|
|
814
814
|
const first = subs[0];
|
|
815
815
|
if (subs.length !== 1 || first == null || typeof first.type !== "string") return null;
|
|
@@ -835,7 +835,7 @@ const EMPTY_CONFIG_FRONTEND_WIDGETS = { LOAD_3D: { prefixValues: [
|
|
|
835
835
|
"clear"
|
|
836
836
|
] } };
|
|
837
837
|
const classifyWidgetInput = (p) => {
|
|
838
|
-
const o = isRecord(p.opts) ? p.opts : null;
|
|
838
|
+
const o = isRecord$1(p.opts) ? p.opts : null;
|
|
839
839
|
if (o?.["forceInput"] === true) return { kind: "slot" };
|
|
840
840
|
if (Array.isArray(p.type) || p.isEnumUnion === true) {
|
|
841
841
|
const tn = typeof p.type === "string" ? p.type : "COMBO";
|
|
@@ -874,8 +874,8 @@ const classifyWidgetInput = (p) => {
|
|
|
874
874
|
};
|
|
875
875
|
}
|
|
876
876
|
const template = o?.["template"];
|
|
877
|
-
if (isRecord(template)) {
|
|
878
|
-
if (isRecord(template["input"])) return parseContainer(template);
|
|
877
|
+
if (isRecord$1(template)) {
|
|
878
|
+
if (isRecord$1(template["input"])) return parseContainer(template);
|
|
879
879
|
return { kind: "slot" };
|
|
880
880
|
}
|
|
881
881
|
if (o?.["socketless"] === true) return {
|
|
@@ -906,7 +906,7 @@ const classifySchemaInput = (input) => classifyWidgetInput({
|
|
|
906
906
|
* backend accepts an explicit null but errors on an ABSENT required key.
|
|
907
907
|
*/
|
|
908
908
|
const defaultValueForWidget = (p) => {
|
|
909
|
-
const o = isRecord(p.opts) ? p.opts : null;
|
|
909
|
+
const o = isRecord$1(p.opts) ? p.opts : null;
|
|
910
910
|
if (o != null && o["default"] !== void 0) return o["default"];
|
|
911
911
|
const widgetTypeName = typeof o?.["widgetType"] === "string" ? o["widgetType"] : p.type;
|
|
912
912
|
if (widgetTypeName === "INT" || widgetTypeName === "FLOAT") return 0;
|
|
@@ -997,7 +997,7 @@ const convertLiteGraphToPrompt = (schema, workflow, opts = {}) => {
|
|
|
997
997
|
if (value == null) return null;
|
|
998
998
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
999
999
|
if (Array.isArray(value)) return { __value__: value };
|
|
1000
|
-
if (!p.strict && isRecord(value)) return value;
|
|
1000
|
+
if (!p.strict && isRecord$1(value)) return value;
|
|
1001
1001
|
throw new WorkflowConvertError("invalid-widget-value", `node ${node.id}(${node.type}) has an invalid widget value for "${p.promptName}": ${JSON.stringify(value)}`, node);
|
|
1002
1002
|
};
|
|
1003
1003
|
/** named wins, then positional cursor (+prefixLen skips leading button values, LOAD_3D); filled=true when both miss (caller falls back to the schema default) */
|
|
@@ -1648,8 +1648,8 @@ var LiteGraphCtx = class {
|
|
|
1648
1648
|
//#endregion
|
|
1649
1649
|
//#region src/runner/outputPath.ts
|
|
1650
1650
|
/**
|
|
1651
|
-
* local output naming, relative to `.comfy-ts/outputs
|
|
1652
|
-
*
|
|
1651
|
+
* local output naming, relative to `.comfy-ts/outputs/`:
|
|
1652
|
+
* the server filename is NOT unique — cloud hosts reset the
|
|
1653
1653
|
* `_00001_` counter every run, so trusting it overwrote the same file — and
|
|
1654
1654
|
* a `foo/krea/` prefix means the DIRECTORY foo/krea/, not a `krea_` name
|
|
1655
1655
|
* prefix. Local names are ours: dir from the prompt's own filename_prefix
|
|
@@ -1694,7 +1694,7 @@ const withExtension = (path, ext) => {
|
|
|
1694
1694
|
/**
|
|
1695
1695
|
* never-overwrite guard: bump `-2`, `-3`, … while the path exists on disk OR
|
|
1696
1696
|
* was already CLAIMED by a still-downloading retrieval (two same-second runs
|
|
1697
|
-
* on a counter-resetting cloud host compute the same name
|
|
1697
|
+
* on a counter-resetting cloud host compute the same name).
|
|
1698
1698
|
* The chosen path is claimed before returning.
|
|
1699
1699
|
*/
|
|
1700
1700
|
const uniquifyOutputPath = (p) => {
|
|
@@ -3884,6 +3884,191 @@ var ResilientWebSocketClient = class {
|
|
|
3884
3884
|
}
|
|
3885
3885
|
};
|
|
3886
3886
|
//#endregion
|
|
3887
|
+
//#region src/utils/isRecord.ts
|
|
3888
|
+
/** narrows unknown wire json to an indexable object (arrays and null excluded) */
|
|
3889
|
+
function isRecord(v) {
|
|
3890
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3891
|
+
}
|
|
3892
|
+
type({
|
|
3893
|
+
items: "unknown[]",
|
|
3894
|
+
"total?": "number"
|
|
3895
|
+
});
|
|
3896
|
+
function readString(item, key) {
|
|
3897
|
+
const v = item[key];
|
|
3898
|
+
return typeof v === "string" && v !== "" ? v : null;
|
|
3899
|
+
}
|
|
3900
|
+
function readStringArray(item, key) {
|
|
3901
|
+
const v = item[key];
|
|
3902
|
+
if (!Array.isArray(v)) return [];
|
|
3903
|
+
return v.filter((x) => typeof x === "string" && x !== "");
|
|
3904
|
+
}
|
|
3905
|
+
function lmModelName(item) {
|
|
3906
|
+
return readString(item, "model_name");
|
|
3907
|
+
}
|
|
3908
|
+
function lmBaseModel(item) {
|
|
3909
|
+
return readString(item, "base_model");
|
|
3910
|
+
}
|
|
3911
|
+
function lmPreviewUrl(item) {
|
|
3912
|
+
return readString(item, "preview_url");
|
|
3913
|
+
}
|
|
3914
|
+
function lmTags(item) {
|
|
3915
|
+
return readStringArray(item, "tags");
|
|
3916
|
+
}
|
|
3917
|
+
/** the trigger words: civitai's `trainedWords`, absent for a lora nobody published */
|
|
3918
|
+
function lmTrainedWords(item) {
|
|
3919
|
+
const civitai = item["civitai"];
|
|
3920
|
+
if (!isRecord(civitai)) return [];
|
|
3921
|
+
return readStringArray(civitai, "trainedWords");
|
|
3922
|
+
}
|
|
3923
|
+
/**
|
|
3924
|
+
* the ONE key space where a host's object_info spelling of a lora meets
|
|
3925
|
+
* lora-manager's: lowercase, forward slashes, no model extension.
|
|
3926
|
+
* `styles\Aurora.safetensors` and lm's folder `styles` + file_name `aurora`
|
|
3927
|
+
* both become `styles/aurora`.
|
|
3928
|
+
*/
|
|
3929
|
+
function loraKey(name) {
|
|
3930
|
+
return name.replaceAll("\\", "/").replace(/\.(safetensors|st|pt|ckpt)$/i, "").toLowerCase();
|
|
3931
|
+
}
|
|
3932
|
+
/** the file's own name, windows separators included (`styles\x.safetensors` → `x.safetensors`) */
|
|
3933
|
+
function loraBasename(name) {
|
|
3934
|
+
return basename(name.replaceAll("\\", "/"));
|
|
3935
|
+
}
|
|
3936
|
+
//#endregion
|
|
3937
|
+
//#region src/host/loraInfoCache.ts
|
|
3938
|
+
function loraMirrorPath(hostId) {
|
|
3939
|
+
return comfyts.resolveFromHosts(join(hostId, "loras.json"));
|
|
3940
|
+
}
|
|
3941
|
+
/** null = never synced (or unreadable, which is LOGGED) */
|
|
3942
|
+
function readLoraMirror(hostId) {
|
|
3943
|
+
const path = loraMirrorPath(hostId);
|
|
3944
|
+
const text = getComfyStorage().readTextIfExists(path);
|
|
3945
|
+
if (text == null) return null;
|
|
3946
|
+
try {
|
|
3947
|
+
const raw = JSON.parse(text);
|
|
3948
|
+
if (!isRecord(raw)) return null;
|
|
3949
|
+
const rawLoras = raw["loras"];
|
|
3950
|
+
if (!isRecord(rawLoras)) return null;
|
|
3951
|
+
const loras = {};
|
|
3952
|
+
for (const [key, item] of Object.entries(rawLoras)) if (isRecord(item)) loras[key] = item;
|
|
3953
|
+
const str = (key, fallback) => {
|
|
3954
|
+
const v = raw[key];
|
|
3955
|
+
return typeof v === "string" ? v : fallback;
|
|
3956
|
+
};
|
|
3957
|
+
return {
|
|
3958
|
+
hostId: str("hostId", hostId),
|
|
3959
|
+
hostUrl: str("hostUrl", ""),
|
|
3960
|
+
fetchedAt: str("fetchedAt", ""),
|
|
3961
|
+
count: Object.keys(loras).length,
|
|
3962
|
+
loras
|
|
3963
|
+
};
|
|
3964
|
+
} catch (e) {
|
|
3965
|
+
logError(`[loraInfoCache] unreadable ${path}: ${String(e)}`);
|
|
3966
|
+
return null;
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
/**
|
|
3970
|
+
* the read model: each registered host's mirror, kept PER HOST.
|
|
3971
|
+
*
|
|
3972
|
+
* Per host, not merged into one map, because the same file name on two hosts is
|
|
3973
|
+
* routinely a different model. A merged map served whichever host loaded first,
|
|
3974
|
+
* so on the other host the overlay showed the wrong model name and the prompt
|
|
3975
|
+
* silently received the wrong trigger words — a bad generation with no error
|
|
3976
|
+
* anywhere. Callers that know their host say so; the rest fall back to any host
|
|
3977
|
+
* that has the lora, which is still better than nothing for a display name.
|
|
3978
|
+
*
|
|
3979
|
+
* Plain (non-observable) on purpose: the loras overlay reads this from inside a
|
|
3980
|
+
* mobx render. The storage seam has no readdir, so the host set comes from
|
|
3981
|
+
* `comfyts.hosts` — exactly the hosts this process can be asked about.
|
|
3982
|
+
*/
|
|
3983
|
+
const byHost = /* @__PURE__ */ new Map();
|
|
3984
|
+
/** hosts already looked for, INCLUDING the ones with no mirror (see reloadLoraInfoCache) */
|
|
3985
|
+
const loadedHostIds = /* @__PURE__ */ new Set();
|
|
3986
|
+
function ensureLoaded() {
|
|
3987
|
+
for (const hostId of comfyts.hosts.keys()) {
|
|
3988
|
+
if (loadedHostIds.has(hostId)) continue;
|
|
3989
|
+
loadedHostIds.add(hostId);
|
|
3990
|
+
const mirror = readLoraMirror(hostId);
|
|
3991
|
+
if (mirror == null) continue;
|
|
3992
|
+
byHost.set(hostId, new Map(Object.entries(mirror.loras)));
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
/**
|
|
3996
|
+
* forget everything loaded, so the next read picks up a fresh `comfy-ts loras`.
|
|
3997
|
+
* A long-lived process (the TUI, `comfy-ts serve`) has no other way to see a
|
|
3998
|
+
* re-sync that happened in another terminal.
|
|
3999
|
+
*/
|
|
4000
|
+
function reloadLoraInfoCache() {
|
|
4001
|
+
byHost.clear();
|
|
4002
|
+
loadedHostIds.clear();
|
|
4003
|
+
}
|
|
4004
|
+
/**
|
|
4005
|
+
* the lm item for a raw lora name (`styles\x.safetensors`).
|
|
4006
|
+
* `hostId` picks the mirror that actually describes this host's file; without
|
|
4007
|
+
* it, any host that knows the name answers. null when unsynced/unknown.
|
|
4008
|
+
*/
|
|
4009
|
+
function getLoraInfo(name, hostId) {
|
|
4010
|
+
ensureLoaded();
|
|
4011
|
+
const key = loraKey(name);
|
|
4012
|
+
if (hostId != null) {
|
|
4013
|
+
const own = byHost.get(hostId);
|
|
4014
|
+
if (own != null) return own.get(key) ?? null;
|
|
4015
|
+
}
|
|
4016
|
+
for (const mirror of byHost.values()) {
|
|
4017
|
+
const hit = mirror.get(key);
|
|
4018
|
+
if (hit != null) return hit;
|
|
4019
|
+
}
|
|
4020
|
+
return null;
|
|
4021
|
+
}
|
|
4022
|
+
/** civitai trigger words for this lora, in civitai's order */
|
|
4023
|
+
function getLoraTriggerWords(name, hostId) {
|
|
4024
|
+
const info = getLoraInfo(name, hostId);
|
|
4025
|
+
return info == null ? [] : lmTrainedWords(info);
|
|
4026
|
+
}
|
|
4027
|
+
/** the human name (`Aurora Ink Wash`), falling back to the file's own name */
|
|
4028
|
+
function getLoraDisplayName(name, hostId) {
|
|
4029
|
+
const info = getLoraInfo(name, hostId);
|
|
4030
|
+
return (info == null ? null : lmModelName(info)) ?? loraBasename(name);
|
|
4031
|
+
}
|
|
4032
|
+
/** server-relative preview url from the mirror, null when unsynced/unknown */
|
|
4033
|
+
function getLoraPreviewUrl(name, hostId) {
|
|
4034
|
+
const info = getLoraInfo(name, hostId);
|
|
4035
|
+
return info == null ? null : lmPreviewUrl(info);
|
|
4036
|
+
}
|
|
4037
|
+
/** the lora's NAMES: the file, and the model name a human would call it by */
|
|
4038
|
+
function loraSearchNames(name, hostId) {
|
|
4039
|
+
const names = [loraBasename(name), name.replaceAll("\\", "/")];
|
|
4040
|
+
const info = getLoraInfo(name, hostId);
|
|
4041
|
+
const modelName = info == null ? null : lmModelName(info);
|
|
4042
|
+
if (modelName != null) names.push(modelName);
|
|
4043
|
+
return names;
|
|
4044
|
+
}
|
|
4045
|
+
/** the lora's FREE TEXT: tags, base model, trigger words */
|
|
4046
|
+
function loraSearchText(name, hostId) {
|
|
4047
|
+
const info = getLoraInfo(name, hostId);
|
|
4048
|
+
if (info == null) return [];
|
|
4049
|
+
const text = [...lmTags(info), ...lmTrainedWords(info)];
|
|
4050
|
+
const baseModel = lmBaseModel(info);
|
|
4051
|
+
if (baseModel != null) text.push(baseModel);
|
|
4052
|
+
return text;
|
|
4053
|
+
}
|
|
4054
|
+
/**
|
|
4055
|
+
* the loras overlay filter: find a lora by its human name, not only by the file
|
|
4056
|
+
* name. EVERY whitespace-separated token must be a SUBSTRING of some field — order
|
|
4057
|
+
* free, so `aurora ink`, `ink aurora` and `styles wash` all land on the same
|
|
4058
|
+
* lora. NOT fuzzyMatch: a subsequence match over phrases this long matches
|
|
4059
|
+
* nearly everything. Measured on a real collection, filtering by each lora's
|
|
4060
|
+
* own file name: this rule peaks at 8 hits where fuzzyMatch matched a third of
|
|
4061
|
+
* every lora present.
|
|
4062
|
+
* Fields are matched one by one, never as a concatenated haystack, for the same
|
|
4063
|
+
* reason. `tests/lora-corpus.private.test.ts` keeps that measurement runnable.
|
|
4064
|
+
*/
|
|
4065
|
+
function loraMatchesFilter(name, filter, hostId) {
|
|
4066
|
+
const tokens = filter.toLowerCase().split(/\s+/).filter((t) => t !== "");
|
|
4067
|
+
if (tokens.length === 0) return true;
|
|
4068
|
+
const fields = [...loraSearchNames(name, hostId), ...loraSearchText(name, hostId)].map((f) => f.toLowerCase());
|
|
4069
|
+
return tokens.every((token) => fields.some((field) => field.includes(token)));
|
|
4070
|
+
}
|
|
4071
|
+
//#endregion
|
|
3887
4072
|
//#region src/vars/loraKeywords.ts
|
|
3888
4073
|
/**
|
|
3889
4074
|
* hand-assigned trigger keyword(s) per lora name — set via ⌃K in the TUI loras
|
|
@@ -3891,6 +4076,12 @@ var ResilientWebSocketClient = class {
|
|
|
3891
4076
|
* `.comfy-ts/lora-keywords.json` (NOT under cache/: this is hand-entered data
|
|
3892
4077
|
* and must survive a cache wipe). Observable map: overlay rows re-render on
|
|
3893
4078
|
* assignment. Keys are the RAW lora names (folder/file.safetensors).
|
|
4079
|
+
*
|
|
4080
|
+
* This file is the OVERRIDE layer. Below it sits the lora-manager mirror's
|
|
4081
|
+
* civitai trigger words (src/host/loraInfoCache.ts, refreshed by
|
|
4082
|
+
* `comfy-ts loras`), so most loras carry a keyword without anyone typing one.
|
|
4083
|
+
* The overlay renders a mirror-sourced keyword dim and a hand-typed one yellow,
|
|
4084
|
+
* and ⌃D drops the override to fall back to the mirror again.
|
|
3894
4085
|
*/
|
|
3895
4086
|
const keywords = observable.map();
|
|
3896
4087
|
let loaded = false;
|
|
@@ -3913,18 +4104,50 @@ function loadOnce() {
|
|
|
3913
4104
|
logError(`[loraKeywords] unreadable ${path}: ${String(e)}`);
|
|
3914
4105
|
}
|
|
3915
4106
|
}
|
|
3916
|
-
|
|
4107
|
+
/** the hand keyword when this lora HAS an entry (`''` included), else the mirror's trigger words */
|
|
4108
|
+
function getLoraKeyword(name, hostId) {
|
|
3917
4109
|
loadOnce();
|
|
3918
|
-
|
|
4110
|
+
const hand = keywords.get(name);
|
|
4111
|
+
if (hand != null) return hand;
|
|
4112
|
+
return getLoraTriggerWords(name, hostId).join(", ");
|
|
3919
4113
|
}
|
|
3920
|
-
/**
|
|
3921
|
-
function
|
|
4114
|
+
/** true when the keyword shown comes from the lora-manager mirror, not from ⌃K */
|
|
4115
|
+
function isLoraKeywordFromMirror(name, hostId) {
|
|
4116
|
+
loadOnce();
|
|
4117
|
+
return !keywords.has(name) && getLoraTriggerWords(name, hostId).length > 0;
|
|
4118
|
+
}
|
|
4119
|
+
/** what `clearLoraKeywordOverride` would restore this lora to, `''` when nothing */
|
|
4120
|
+
function loraKeywordFromMirror(name, hostId) {
|
|
4121
|
+
return getLoraTriggerWords(name, hostId).join(", ");
|
|
4122
|
+
}
|
|
4123
|
+
/**
|
|
4124
|
+
* drop the hand entry entirely, so the mirror's trigger words apply again.
|
|
4125
|
+
* The way BACK from an empty-string tombstone: without it, clearing a keyword on
|
|
4126
|
+
* a lora that has trigger words was a one-way door only a text editor could undo.
|
|
4127
|
+
*/
|
|
4128
|
+
function clearLoraKeywordOverride(name) {
|
|
4129
|
+
loadOnce();
|
|
4130
|
+
if (!keywords.has(name)) return;
|
|
4131
|
+
runInAction(() => void keywords.delete(name));
|
|
4132
|
+
writeKeywords();
|
|
4133
|
+
}
|
|
4134
|
+
/**
|
|
4135
|
+
* empty keyword deletes the entry — EXCEPT when the mirror has trigger words for
|
|
4136
|
+
* this lora: there `''` is stored as an explicit tombstone, the only way to say
|
|
4137
|
+
* "inject nothing" about a lora civitai gave words to. Every set writes the file
|
|
4138
|
+
* (tiny, rare).
|
|
4139
|
+
*/
|
|
4140
|
+
function setLoraKeyword(name, keyword, hostId) {
|
|
3922
4141
|
loadOnce();
|
|
3923
4142
|
const trimmed = keyword.trim();
|
|
3924
4143
|
runInAction(() => {
|
|
3925
|
-
if (trimmed === "") keywords.delete(name);
|
|
4144
|
+
if (trimmed === "" && getLoraTriggerWords(name, hostId).length === 0) keywords.delete(name);
|
|
3926
4145
|
else keywords.set(name, trimmed);
|
|
3927
4146
|
});
|
|
4147
|
+
writeKeywords();
|
|
4148
|
+
}
|
|
4149
|
+
/** every set writes the file: it is tiny and hand-edited rarely */
|
|
4150
|
+
function writeKeywords() {
|
|
3928
4151
|
const path = filePath();
|
|
3929
4152
|
try {
|
|
3930
4153
|
getComfyStorage().writeText(path, JSON.stringify(Object.fromEntries([...keywords.entries()].sort()), null, 2));
|
|
@@ -4031,7 +4254,7 @@ var PromptVar = class extends ComfyVarBase {
|
|
|
4031
4254
|
injectedKeywords() {
|
|
4032
4255
|
const src = this.promptOpts.loraKeywordsFrom;
|
|
4033
4256
|
if (src == null) return [];
|
|
4034
|
-
return [...new Set(src.activeNames().map(getLoraKeyword).filter((k) => k !== ""))];
|
|
4257
|
+
return [...new Set(src.activeNames().map((name) => getLoraKeyword(name, src.hostId)).filter((k) => k !== ""))];
|
|
4035
4258
|
}
|
|
4036
4259
|
outValue() {
|
|
4037
4260
|
const pos = [];
|
|
@@ -4223,6 +4446,7 @@ var LorasVar = class LorasVar extends ComfyVar {
|
|
|
4223
4446
|
this.kind = "loras";
|
|
4224
4447
|
this.prev = {};
|
|
4225
4448
|
this.resolvedOptions = null;
|
|
4449
|
+
this.hostId = void 0;
|
|
4226
4450
|
}
|
|
4227
4451
|
get options() {
|
|
4228
4452
|
if (!(this.optionsSource instanceof RegExp)) return this.optionsSource;
|
|
@@ -4233,6 +4457,7 @@ var LorasVar = class LorasVar extends ComfyVar {
|
|
|
4233
4457
|
* cast: whitelist family 1 (agent/coding.md) — getLoras() returns the runtime
|
|
4234
4458
|
* values of the SAME object_info enum the generated E_LoraName union comes from */
|
|
4235
4459
|
bindHost(host) {
|
|
4460
|
+
this.hostId = host.data?.id;
|
|
4236
4461
|
if (!(this.optionsSource instanceof RegExp)) return;
|
|
4237
4462
|
this.resolvedOptions = host.schema.getLoras(this.optionsSource);
|
|
4238
4463
|
}
|
|
@@ -4351,7 +4576,7 @@ const DEFAULT_SIZE_PRESETS = [
|
|
|
4351
4576
|
}
|
|
4352
4577
|
];
|
|
4353
4578
|
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
4354
|
-
* size of a linked image var (
|
|
4579
|
+
* size of a linked image var (the widget shows
|
|
4355
4580
|
* `WxH size of image '<name>'` as a pickable row) */
|
|
4356
4581
|
var SizeVar = class extends ComfyVar {
|
|
4357
4582
|
constructor(defaultValue = {
|
|
@@ -5757,6 +5982,6 @@ function loraTag(name, strength = 1, clipStrength) {
|
|
|
5757
5982
|
*/
|
|
5758
5983
|
setDefaultComfyStorage(createMemoryStorage());
|
|
5759
5984
|
//#endregion
|
|
5760
|
-
export { ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, PromptVar, ResilientWebSocketClient, SeedVar, SizeVar, TextVar, ToggleVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraKeyword, hostIdToNamespace, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
5985
|
+
export { ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, PromptVar, ResilientWebSocketClient, SeedVar, SizeVar, TextVar, ToggleVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, 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, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
5761
5986
|
|
|
5762
5987
|
//# sourceMappingURL=web.js.map
|