comfy-ts 2.2.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 +292 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -9
- package/dist/index.d.ts +147 -9
- package/dist/index.js +280 -25
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-C1oo5ilG.js → run-serve-C9E8dyLP.js} +7 -3
- package/dist/run-serve-C9E8dyLP.js.map +1 -0
- package/dist/{run-tui-CuVst-nc.js → run-tui-cawSJuuh.js} +60 -121
- package/dist/run-tui-cawSJuuh.js.map +1 -0
- package/dist/{state-CvMt0W1-.js → state-BbKuSDCV.js} +38 -77
- package/dist/state-BbKuSDCV.js.map +1 -0
- package/dist/web.d.ts +147 -9
- package/dist/web.js +280 -25
- 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/ServeApp.ts +4 -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 +21 -1
- package/src/host/ComfyHost.ts +51 -3
- 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-C1oo5ilG.js.map +0 -1
- package/dist/run-tui-CuVst-nc.js.map +0 -1
- package/dist/state-CvMt0W1-.js.map +0 -1
package/dist/index.d.cts
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[];
|
|
@@ -16340,7 +16349,20 @@ type ConnectOptions = {
|
|
|
16340
16349
|
schema?: 'auto' | 'refresh' | 'cache';
|
|
16341
16350
|
/** max cache age for 'auto' (default 24h) */
|
|
16342
16351
|
maxAgeMs?: number;
|
|
16352
|
+
/**
|
|
16353
|
+
* deadline for the FIRST connect, default 30s. 0 or Infinity waits forever.
|
|
16354
|
+
* A refused TCP connection is a ws CLOSE, not a dead transport, so without a
|
|
16355
|
+
* deadline `connect()` sat in the 2s reconnect loop and never settled: scripts
|
|
16356
|
+
* hung with no error and `comfy-ts serve` wedged the module behind its mutex.
|
|
16357
|
+
* Reconnects AFTER a successful connect are untouched and still retry forever.
|
|
16358
|
+
*/
|
|
16359
|
+
timeoutMs?: number;
|
|
16343
16360
|
};
|
|
16361
|
+
/** the host never came up within ConnectOptions.timeoutMs */
|
|
16362
|
+
declare class ComfyHostUnreachableError extends Error {
|
|
16363
|
+
/** name, not instanceof: the cli bundle and dist/index.js each define this class */
|
|
16364
|
+
readonly name = "ComfyHostUnreachableError";
|
|
16365
|
+
}
|
|
16344
16366
|
type SchemaUpdateResult = Maybe<{
|
|
16345
16367
|
type: 'success';
|
|
16346
16368
|
} | {
|
|
@@ -16458,6 +16480,8 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16458
16480
|
* - 'cache': never fetch (throws when no cache exists)
|
|
16459
16481
|
*/
|
|
16460
16482
|
connect: (p?: ConnectOptions) => Promise<void>;
|
|
16483
|
+
private _connectTimer;
|
|
16484
|
+
private clearConnectTimer;
|
|
16461
16485
|
/** close the websocket (e.g. to let a script exit) */
|
|
16462
16486
|
disconnect: () => void;
|
|
16463
16487
|
private markReady;
|
|
@@ -17327,9 +17351,123 @@ workflow: CanonicalWorkflow, opts?: {
|
|
|
17327
17351
|
}) => ComfyApiJson;
|
|
17328
17352
|
//#endregion
|
|
17329
17353
|
//#region src/vars/loraKeywords.d.ts
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
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;
|
|
17333
17471
|
//#endregion
|
|
17334
17472
|
//#region src/utils/loraTag.d.ts
|
|
17335
17473
|
/**
|
|
@@ -17354,5 +17492,5 @@ declare function exampleImagePath(name: string): string;
|
|
|
17354
17492
|
//#region src/cli/tui-env.d.ts
|
|
17355
17493
|
declare function isTuiActive(): boolean;
|
|
17356
17494
|
//#endregion
|
|
17357
|
-
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, 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, exampleImagePath, getComfyStorage, getLoraKeyword, hostIdToNamespace, isTuiActive, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
17495
|
+
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, exampleImagePath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
17358
17496
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.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[];
|
|
@@ -16340,7 +16349,20 @@ type ConnectOptions = {
|
|
|
16340
16349
|
schema?: 'auto' | 'refresh' | 'cache';
|
|
16341
16350
|
/** max cache age for 'auto' (default 24h) */
|
|
16342
16351
|
maxAgeMs?: number;
|
|
16352
|
+
/**
|
|
16353
|
+
* deadline for the FIRST connect, default 30s. 0 or Infinity waits forever.
|
|
16354
|
+
* A refused TCP connection is a ws CLOSE, not a dead transport, so without a
|
|
16355
|
+
* deadline `connect()` sat in the 2s reconnect loop and never settled: scripts
|
|
16356
|
+
* hung with no error and `comfy-ts serve` wedged the module behind its mutex.
|
|
16357
|
+
* Reconnects AFTER a successful connect are untouched and still retry forever.
|
|
16358
|
+
*/
|
|
16359
|
+
timeoutMs?: number;
|
|
16343
16360
|
};
|
|
16361
|
+
/** the host never came up within ConnectOptions.timeoutMs */
|
|
16362
|
+
declare class ComfyHostUnreachableError extends Error {
|
|
16363
|
+
/** name, not instanceof: the cli bundle and dist/index.js each define this class */
|
|
16364
|
+
readonly name = "ComfyHostUnreachableError";
|
|
16365
|
+
}
|
|
16344
16366
|
type SchemaUpdateResult = Maybe<{
|
|
16345
16367
|
type: 'success';
|
|
16346
16368
|
} | {
|
|
@@ -16458,6 +16480,8 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16458
16480
|
* - 'cache': never fetch (throws when no cache exists)
|
|
16459
16481
|
*/
|
|
16460
16482
|
connect: (p?: ConnectOptions) => Promise<void>;
|
|
16483
|
+
private _connectTimer;
|
|
16484
|
+
private clearConnectTimer;
|
|
16461
16485
|
/** close the websocket (e.g. to let a script exit) */
|
|
16462
16486
|
disconnect: () => void;
|
|
16463
16487
|
private markReady;
|
|
@@ -17327,9 +17351,123 @@ workflow: CanonicalWorkflow, opts?: {
|
|
|
17327
17351
|
}) => ComfyApiJson;
|
|
17328
17352
|
//#endregion
|
|
17329
17353
|
//#region src/vars/loraKeywords.d.ts
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
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;
|
|
17333
17471
|
//#endregion
|
|
17334
17472
|
//#region src/utils/loraTag.d.ts
|
|
17335
17473
|
/**
|
|
@@ -17354,5 +17492,5 @@ declare function exampleImagePath(name: string): string;
|
|
|
17354
17492
|
//#region src/cli/tui-env.d.ts
|
|
17355
17493
|
declare function isTuiActive(): boolean;
|
|
17356
17494
|
//#endregion
|
|
17357
|
-
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, 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, exampleImagePath, getComfyStorage, getLoraKeyword, hostIdToNamespace, isTuiActive, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
17495
|
+
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, exampleImagePath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
17358
17496
|
//# sourceMappingURL=index.d.ts.map
|