comfy-ts 1.3.0 → 2.0.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 +106 -6
- package/dist/{DefinedWorkflow-gpknV-5f.js → DefinedWorkflow-CqNE_kgR.js} +67 -14
- package/dist/DefinedWorkflow-CqNE_kgR.js.map +1 -0
- package/dist/{DraftsSt-DmA0jWGl.js → DraftsSt-Da4DZUP7.js} +2 -2
- package/dist/{DraftsSt-DmA0jWGl.js.map → DraftsSt-Da4DZUP7.js.map} +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.cjs +548 -239
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -116
- package/dist/index.d.ts +165 -117
- package/dist/index.js +540 -230
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-Bn6yIJB0.js → run-serve-BqeXtf8P.js} +9 -7
- package/dist/run-serve-BqeXtf8P.js.map +1 -0
- package/dist/{run-tui-BtjaOXRh.js → run-tui-CiB7TbYv.js} +18 -13
- package/dist/run-tui-CiB7TbYv.js.map +1 -0
- package/dist/{state-DKCPy105.js → state-C1g_B8zR.js} +398 -201
- package/dist/state-C1g_B8zR.js.map +1 -0
- package/dist/web.d.ts +17335 -0
- package/dist/web.js +5715 -0
- package/dist/web.js.map +1 -0
- package/examples/comfy-cloud/ace-step-t2a.cflow.ts +1 -0
- package/examples/comfy-cloud/anima-t2i.cflow.ts +2 -3
- package/examples/comfy-cloud/boogu-i2i.cflow.ts +2 -5
- package/examples/comfy-cloud/capybara-i2i.cflow.ts +2 -2
- package/examples/comfy-cloud/capybara-i2v.cflow.ts +1 -0
- package/examples/comfy-cloud/capybara-t2i.cflow.ts +2 -2
- package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +1 -0
- package/examples/comfy-cloud/chroma-t2i.cflow.ts +2 -5
- package/examples/comfy-cloud/ernie-t2i.cflow.ts +2 -3
- package/examples/comfy-cloud/firered-i2i.cflow.ts +2 -2
- package/examples/comfy-cloud/flux1-i2i.cflow.ts +2 -2
- package/examples/comfy-cloud/flux1-t2i.cflow.ts +2 -2
- package/examples/comfy-cloud/flux2-i2i.cflow.ts +2 -5
- package/examples/comfy-cloud/flux2-t2i.cflow.ts +2 -5
- package/examples/comfy-cloud/hidream-i2i.cflow.ts +2 -5
- package/examples/comfy-cloud/hidream-t2i.cflow.ts +2 -2
- package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +1 -0
- package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +1 -0
- package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +2 -3
- package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +1 -0
- package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +2 -2
- package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +1 -0
- package/examples/comfy-cloud/krea2-t2i.cflow.ts +2 -3
- package/examples/comfy-cloud/lens-t2i.cflow.ts +2 -3
- package/examples/comfy-cloud/longcat-i2i.cflow.ts +2 -2
- package/examples/comfy-cloud/longcat-t2i.cflow.ts +2 -5
- package/examples/comfy-cloud/ltxv-i2v.cflow.ts +1 -0
- package/examples/comfy-cloud/ltxv-t2v.cflow.ts +1 -0
- package/examples/comfy-cloud/newbie-t2i.cflow.ts +2 -5
- package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +2 -5
- package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +2 -5
- package/examples/comfy-cloud/ovis-t2i.cflow.ts +2 -5
- package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +2 -5
- package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +2 -2
- package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +2 -2
- package/examples/comfy-cloud/sd35-t2i.cflow.ts +2 -2
- package/examples/comfy-cloud/sdk.d.ts +13251 -11458
- package/examples/comfy-cloud/sdxl-t2i.cflow.ts +2 -2
- package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +1 -0
- package/examples/comfy-cloud/svd-i2v.cflow.ts +1 -0
- package/examples/comfy-cloud/wan21-i2v.cflow.ts +1 -0
- package/examples/comfy-cloud/wan21-t2v.cflow.ts +1 -0
- package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +1 -0
- package/examples/comfy-cloud/wan22-i2v.cflow.ts +1 -0
- package/examples/comfy-cloud/wan22-t2v.cflow.ts +1 -0
- package/examples/comfy-cloud/z-image-t2i.cflow.ts +2 -5
- package/examples/rvion/01-txt2img.cflow.ts +5 -3
- package/examples/rvion/02-img2img-upload.cflow.ts +5 -4
- package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +6 -7
- package/examples/rvion/05-comfy-cloud.cflow.ts +4 -2
- package/examples/rvion/06-qwen-image-edit.cflow.ts +2 -3
- package/examples/web/example.ts +78 -0
- package/examples/web/index.html +77 -0
- package/examples/web/serve.ts +42 -0
- package/examples/web/tsconfig.json +15 -0
- package/package.json +8 -2
- package/src/cli/serve/ServeApp.ts +9 -6
- package/src/cli/tui/state/ExecSt.ts +14 -2
- package/src/coreExports.ts +118 -0
- package/src/host/ComfyHost.ts +56 -24
- package/src/host/ResilientWebsocket.ts +93 -47
- package/src/host/hostUrl.ts +2 -1
- package/src/host/loraManagerApi.ts +6 -7
- package/src/index.ts +8 -107
- package/src/manager/loaders/step2_custom-node-list-loader.ts +4 -4
- package/src/manager/loaders/step3_extension-node-map-loader.ts +3 -3
- package/src/manager/loaders/step4_model-list-loader.ts +7 -7
- package/src/manager/loaders/step5_alter-list-loader.ts +2 -2
- package/src/manager/loaders/step6_github-stats-loader.ts +2 -2
- package/src/runner/ComfyExecution.ts +168 -77
- package/src/runner/ComfyWorkflow.ts +25 -3
- package/src/runner/ComfyWsApi.ts +6 -0
- package/src/runner/MediaImage.ts +73 -38
- package/src/runner/ephemeral.ts +21 -0
- package/src/runner/outputPath.ts +2 -2
- package/src/sdk-generator/ComfySchema.ts +2 -2
- package/src/sdk-generator/_pythonModuleToNamespace.ts +3 -0
- package/src/state.ts +13 -9
- package/src/storage/ComfyStorage.ts +144 -0
- package/src/storage/nodeStorage.ts +9 -0
- package/src/types/index.ts +6 -2
- package/src/utils/downloadFile.ts +11 -69
- package/src/utils/hashArrayBuffer.ts +3 -4
- package/src/utils/lazySharp.ts +25 -0
- package/src/utils/sha1.ts +69 -0
- package/src/vars/ComfyVars.ts +5 -6
- package/src/vars/DefinedWorkflow.ts +3 -1
- package/src/vars/loraKeywords.ts +6 -6
- package/src/web.ts +13 -0
- package/dist/DefinedWorkflow-gpknV-5f.js.map +0 -1
- package/dist/run-serve-Bn6yIJB0.js.map +0 -1
- package/dist/run-tui-BtjaOXRh.js.map +0 -1
- package/dist/state-DKCPy105.js.map +0 -1
- package/src/utils/writeFile.ts +0 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Sharp } from "sharp";
|
|
2
1
|
import { ImageMeta } from "image-meta";
|
|
3
|
-
import
|
|
2
|
+
import { Sharp } from "sharp";
|
|
4
3
|
//#region src/manager/generated/KnownComfyPluginTitle.d.ts
|
|
5
4
|
type KnownComfyPluginTitle =
|
|
6
5
|
/** ComfyUI-Light-N-Color - https://github.com/KAVVATARE/ComfyUI-Light-N-Color */
|
|
@@ -11781,9 +11780,13 @@ type RelativePath = Tagged<string, {
|
|
|
11781
11780
|
declare const asAbsolutePath: (path: string) => AbsolutePath;
|
|
11782
11781
|
declare const asRelativePath: (path: string) => RelativePath;
|
|
11783
11782
|
type ConvertibleImageFormat = 'image/png' | 'image/jpeg' | 'image/webp' | 'raw';
|
|
11784
|
-
|
|
11785
|
-
|
|
11783
|
+
/** local disk saving is OPT-IN per run: `save: true` = raw bytes, an object re-encodes/relocates */
|
|
11784
|
+
type SaveOptions = {
|
|
11785
|
+
/** 'raw' (default) writes the bytes untouched; an image/* mime re-encodes through sharp */
|
|
11786
|
+
format?: ConvertibleImageFormat;
|
|
11787
|
+
/** local dir under `.comfy-ts/outputs/` (wins over the prompt's own filename_prefix) */
|
|
11786
11788
|
prefix?: string;
|
|
11789
|
+
/** 0..1, re-encode only */
|
|
11787
11790
|
quality?: number;
|
|
11788
11791
|
};
|
|
11789
11792
|
type Either<L, R> = {
|
|
@@ -12209,6 +12212,15 @@ declare const types$1: import("arktype").Module<{
|
|
|
12209
12212
|
}>;
|
|
12210
12213
|
type NodeProgress = typeof types$1.NodeProgress.infer;
|
|
12211
12214
|
type PromptRelated_WsMsg = typeof types$1.PromptRelated_WsMsg.infer;
|
|
12215
|
+
/** a binary preview-kind ws frame buffered IN ORDER with the json messages
|
|
12216
|
+
* during the pre-registration window (ComfyHost._pendingMsgs) — replayed by
|
|
12217
|
+
* ComfyExecution.onCreate, which decides output-vs-latent at replay time */
|
|
12218
|
+
type PendingBinaryFrame = {
|
|
12219
|
+
type: 'binary_preview_frame';
|
|
12220
|
+
bytes: Uint8Array;
|
|
12221
|
+
mime: string;
|
|
12222
|
+
};
|
|
12223
|
+
type PendingWsItem = PromptRelated_WsMsg | PendingBinaryFrame;
|
|
12212
12224
|
type WsMsg = typeof types$1.WsMsg.infer;
|
|
12213
12225
|
type ComfyStatusData = typeof types$1.ComfyStatusData.infer;
|
|
12214
12226
|
type WsMsgExecutionCached = typeof types$1.WsMsgExecutionCached.infer;
|
|
@@ -12540,7 +12552,8 @@ type ComfyImageName = Branded<string, {
|
|
|
12540
12552
|
//#endregion
|
|
12541
12553
|
//#region src/runner/MediaImage.d.ts
|
|
12542
12554
|
type MediaImageData = {
|
|
12543
|
-
|
|
12555
|
+
/** absent = in-memory image (ws output with local saving off) — the buffer is then required */
|
|
12556
|
+
path?: Maybe<AbsolutePath>;
|
|
12544
12557
|
buffer?: Uint8Array;
|
|
12545
12558
|
execution?: ComfyExecution;
|
|
12546
12559
|
promptNodeID?: string | null;
|
|
@@ -12551,7 +12564,8 @@ type ImageInfos_ComfyGenerated = {
|
|
|
12551
12564
|
comfyImageInfo: ComfyImageInfo;
|
|
12552
12565
|
};
|
|
12553
12566
|
declare class MediaImage {
|
|
12554
|
-
|
|
12567
|
+
/** null for in-memory images (local saving is opt-in — architecture.md item 14) */
|
|
12568
|
+
absPath: AbsolutePath | null;
|
|
12555
12569
|
/** the execution this image came from (null when not generated via comfy-ts) */
|
|
12556
12570
|
execution: Maybe<ComfyExecution>;
|
|
12557
12571
|
/** return the workflow from which this image was generated */
|
|
@@ -12562,7 +12576,7 @@ declare class MediaImage {
|
|
|
12562
12576
|
tags: string[];
|
|
12563
12577
|
/** the image as a Blob, e.g. to feed FormData uploads */
|
|
12564
12578
|
getAsBlob(): Blob;
|
|
12565
|
-
/** return the image filename */
|
|
12579
|
+
/** return the image filename (in-memory images get a stable hash-derived name) */
|
|
12566
12580
|
get filename(): string;
|
|
12567
12581
|
get baseNameWithoutExtension(): string;
|
|
12568
12582
|
/**
|
|
@@ -12581,6 +12595,11 @@ declare class MediaImage {
|
|
|
12581
12595
|
channel: 'alpha' | 'blue' | 'green' | 'red',
|
|
12582
12596
|
/** workflow to load image as mask into */
|
|
12583
12597
|
workflow: ComfyWorkflow<WID>) => Promise<NodeOf<WID, 'LoadImageMask'>>;
|
|
12598
|
+
/** load this image into the workflow WITHOUT any server-side file: the
|
|
12599
|
+
* image rides base64 inside the prompt JSON (architecture.md item 14 —
|
|
12600
|
+
* the prompt still enters server history; `scrubHistory` covers that).
|
|
12601
|
+
* Feature-detected against the host schema; no supported node = loud throw. */
|
|
12602
|
+
loadInWorkflow_viaBase64Node: <WID extends string>(workflow: ComfyWorkflow<WID>) => NodeOf<WID, 'LoadImage'>;
|
|
12584
12603
|
/** return the json of the ComfyNode that led to this image */
|
|
12585
12604
|
get ComfyNode(): Maybe<ComfyApiNodeJson>;
|
|
12586
12605
|
/**
|
|
@@ -12607,6 +12626,7 @@ declare class MediaImage {
|
|
|
12607
12626
|
/** lazilly loaded, call recomputeMetadata to expire */
|
|
12608
12627
|
private _buffer;
|
|
12609
12628
|
get buffer(): Uint8Array;
|
|
12629
|
+
/** no-op on in-memory images: the buffer is the only copy */
|
|
12610
12630
|
freeBuffer: () => void;
|
|
12611
12631
|
updateBuffer: (buff: Uint8Array) => void;
|
|
12612
12632
|
reloadBuffer: () => Uint8Array;
|
|
@@ -12632,8 +12652,6 @@ declare class MediaImage {
|
|
|
12632
12652
|
fn: (sharp: Sharp) => Sharp,
|
|
12633
12653
|
/** where to save the resulting image */
|
|
12634
12654
|
path?: AbsolutePath) => Promise<MediaImage>;
|
|
12635
|
-
generatePreview: (targetPath: string) => Promise<void>;
|
|
12636
|
-
generateMiniPreview: () => Promise<string>;
|
|
12637
12655
|
}
|
|
12638
12656
|
//#endregion
|
|
12639
12657
|
//#region src/runner/ComfyExecution.d.ts
|
|
@@ -12655,11 +12673,18 @@ declare class ComfyExecution {
|
|
|
12655
12673
|
get host(): ComfyHost;
|
|
12656
12674
|
constructor(workflow: ComfyWorkflow, data: ComfyExecutionData, init?: {
|
|
12657
12675
|
snapshot?: ExecutionSnapshot;
|
|
12658
|
-
|
|
12676
|
+
save?: Maybe<boolean | SaveOptions>;
|
|
12677
|
+
scrubHistory?: boolean;
|
|
12678
|
+
ephemeral?: boolean;
|
|
12659
12679
|
onProgress?: Maybe<(p: ExecutionProgress) => void>;
|
|
12660
12680
|
logProgress?: boolean;
|
|
12661
12681
|
});
|
|
12662
|
-
|
|
12682
|
+
/** local disk saving, OPT-IN (architecture.md item 14); null = outputs stay in memory */
|
|
12683
|
+
save: Maybe<SaveOptions>;
|
|
12684
|
+
/** delete this run's server history entry after `done` */
|
|
12685
|
+
scrubHistory: boolean;
|
|
12686
|
+
/** this run's SaveImage nodes were rewritten to SaveImageWebsocket in the snapshot */
|
|
12687
|
+
ephemeral: boolean;
|
|
12663
12688
|
/** exactly what was sent to the host, frozen at send time (replayable) */
|
|
12664
12689
|
snapshot: Maybe<ExecutionSnapshot>;
|
|
12665
12690
|
/** called on every progress-relevant websocket message */
|
|
@@ -12677,7 +12702,7 @@ declare class ComfyExecution {
|
|
|
12677
12702
|
onCreate(): void;
|
|
12678
12703
|
get progressGlobal(): ProgressReport;
|
|
12679
12704
|
get status(): 'New' | 'Scheduled' | 'Running' | 'Success' | 'Failure';
|
|
12680
|
-
onPromptRelatedMessage: (msg:
|
|
12705
|
+
onPromptRelatedMessage: (msg: PendingWsItem) => void;
|
|
12681
12706
|
/** update pointer to the currently executing node */
|
|
12682
12707
|
private onExecuting;
|
|
12683
12708
|
private onExecutionSuccess;
|
|
@@ -12685,12 +12710,30 @@ declare class ComfyExecution {
|
|
|
12685
12710
|
/** update execution list */
|
|
12686
12711
|
private onExecuted;
|
|
12687
12712
|
private pendingPromises;
|
|
12688
|
-
/** image retrievals that failed (their images are missing from `images`)
|
|
12713
|
+
/** image retrievals that failed (their images are missing from `images`);
|
|
12714
|
+
* `image` is null for SaveImageWebsocket frames (no server-side file info exists) */
|
|
12689
12715
|
imageErrors: {
|
|
12690
|
-
image: ComfyImageInfo
|
|
12716
|
+
image: Maybe<ComfyImageInfo>;
|
|
12691
12717
|
error: unknown;
|
|
12692
12718
|
}[];
|
|
12693
12719
|
retrieveImage: (comfyImageInfo: ComfyImageInfo, promptNodeID: ComfyNodeId) => Promise<void>;
|
|
12720
|
+
/** re-encode when asked, then write under OUR local naming — never the raw
|
|
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 (his repro 2026-07-31) */
|
|
12723
|
+
private encodeAndWrite;
|
|
12724
|
+
/** accumulate an output on the prompt; tags from node metadata ride along */
|
|
12725
|
+
private pushImage;
|
|
12726
|
+
/** true while the currently executing node is a SaveImageWebsocket in the
|
|
12727
|
+
* SENT snapshot (the ephemeral rewrite only touches the snapshot, so the
|
|
12728
|
+
* live graph may still say SaveImage) — binary frames are then OUTPUTS */
|
|
12729
|
+
get wsOutputNodeExecuting(): boolean;
|
|
12730
|
+
/** one binary ws frame = one output image of the executing SaveImageWebsocket
|
|
12731
|
+
* node (architecture.md item 14 — the zero-server-disk path) */
|
|
12732
|
+
onWsImageOutput: (p: {
|
|
12733
|
+
bytes: Uint8Array;
|
|
12734
|
+
mime: string;
|
|
12735
|
+
}) => void;
|
|
12736
|
+
private storeWsImage;
|
|
12694
12737
|
/** images retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
12695
12738
|
images: MediaImage[];
|
|
12696
12739
|
update(data: Partial<ComfyExecutionData>): void;
|
|
@@ -15788,11 +15831,30 @@ declare function parseHostBase(p: {
|
|
|
15788
15831
|
}): ParsedHostBase;
|
|
15789
15832
|
/** http(s) base, port omitted when it is the scheme default */
|
|
15790
15833
|
declare function renderHttpBase(p: ParsedHostBase): string;
|
|
15791
|
-
/** ws(s) endpoint; auth
|
|
15834
|
+
/** ws(s) endpoint; auth rides the upgrade headers — EXCEPT headerless
|
|
15835
|
+
* transports (browser), where the ws client remaps X-API-Key to ?token= */
|
|
15792
15836
|
declare function renderWsUrl(p: ParsedHostBase): string;
|
|
15793
15837
|
//#endregion
|
|
15794
15838
|
//#region src/host/ResilientWebsocket.d.ts
|
|
15795
|
-
type Message = string |
|
|
15839
|
+
type Message = string | Uint8Array;
|
|
15840
|
+
/** structural face of both transports (ws package AND browser WebSocket) */
|
|
15841
|
+
type WsLike = {
|
|
15842
|
+
binaryType: string;
|
|
15843
|
+
onmessage: ((event: WsMessageEvent) => void) | null;
|
|
15844
|
+
onopen: ((event: unknown) => void) | null;
|
|
15845
|
+
onclose: ((event: WsCloseEvent) => void) | null;
|
|
15846
|
+
onerror: ((event: unknown) => void) | null;
|
|
15847
|
+
send(data: Message): void;
|
|
15848
|
+
close(): void;
|
|
15849
|
+
};
|
|
15850
|
+
/** what both transports deliver with binaryType 'arraybuffer': string or ArrayBuffer in `data` */
|
|
15851
|
+
type WsMessageEvent = {
|
|
15852
|
+
data: unknown;
|
|
15853
|
+
};
|
|
15854
|
+
type WsCloseEvent = {
|
|
15855
|
+
code: number;
|
|
15856
|
+
reason: string;
|
|
15857
|
+
};
|
|
15796
15858
|
type WsDebugMessage = {
|
|
15797
15859
|
type: 'info' | 'error';
|
|
15798
15860
|
timestamp: number;
|
|
@@ -15801,11 +15863,16 @@ type WsDebugMessage = {
|
|
|
15801
15863
|
declare class ResilientWebSocketClient {
|
|
15802
15864
|
options: {
|
|
15803
15865
|
url: () => string;
|
|
15804
|
-
/** upgrade-request headers (auth: X-API-Key & co) — a thunk, re-read on every reconnect
|
|
15866
|
+
/** upgrade-request headers (auth: X-API-Key & co) — a thunk, re-read on every reconnect.
|
|
15867
|
+
* On a headerless transport (browser) X-API-Key rides `?token=` instead
|
|
15868
|
+
* (the probed Comfy Cloud contract); other headers throw loud. */
|
|
15805
15869
|
headers?: () => Record<string, string>;
|
|
15806
|
-
onMessage: (event:
|
|
15870
|
+
onMessage: (event: WsMessageEvent) => void;
|
|
15807
15871
|
onConnectOrReconnect: () => void;
|
|
15808
15872
|
onClose: () => void;
|
|
15873
|
+
/** transport unrecoverable (no ws package AND no global WebSocket, or ctor threw):
|
|
15874
|
+
* reported here ONCE, the client goes permanently closed — never a retry storm */
|
|
15875
|
+
onTransportDead?: (error: unknown) => void;
|
|
15809
15876
|
};
|
|
15810
15877
|
private url;
|
|
15811
15878
|
private currentWS?;
|
|
@@ -15816,34 +15883,27 @@ declare class ResilientWebSocketClient {
|
|
|
15816
15883
|
private addError;
|
|
15817
15884
|
constructor(options: {
|
|
15818
15885
|
url: () => string;
|
|
15819
|
-
/** upgrade-request headers (auth: X-API-Key & co) — a thunk, re-read on every reconnect
|
|
15886
|
+
/** upgrade-request headers (auth: X-API-Key & co) — a thunk, re-read on every reconnect.
|
|
15887
|
+
* On a headerless transport (browser) X-API-Key rides `?token=` instead
|
|
15888
|
+
* (the probed Comfy Cloud contract); other headers throw loud. */
|
|
15820
15889
|
headers?: () => Record<string, string>;
|
|
15821
|
-
onMessage: (event:
|
|
15890
|
+
onMessage: (event: WsMessageEvent) => void;
|
|
15822
15891
|
onConnectOrReconnect: () => void;
|
|
15823
15892
|
onClose: () => void;
|
|
15893
|
+
/** transport unrecoverable (no ws package AND no global WebSocket, or ctor threw):
|
|
15894
|
+
* reported here ONCE, the client goes permanently closed — never a retry storm */
|
|
15895
|
+
onTransportDead?: (error: unknown) => void;
|
|
15824
15896
|
});
|
|
15825
15897
|
private reconnectTimeout?;
|
|
15826
15898
|
private permanentlyClosed;
|
|
15827
15899
|
/** close and stop reconnecting (lets a script exit cleanly) */
|
|
15828
15900
|
disconnectPermanently(): void;
|
|
15901
|
+
/** headerless transports carry the api key as ?token= — everything else is refused loud */
|
|
15902
|
+
private headerlessUrl;
|
|
15829
15903
|
private connect;
|
|
15830
15904
|
send(message: Message): void;
|
|
15831
15905
|
private flushMessageBuffer;
|
|
15832
|
-
/** forward WebSocket add event listeners to the current WebSocket instance */
|
|
15833
|
-
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: ((event: WebSocket.WebSocketEventMap[K]) => void) | {
|
|
15834
|
-
handleEvent(event: WebSocket.WebSocketEventMap[K]): void;
|
|
15835
|
-
}, options?: WebSocket.EventListenerOptions): void;
|
|
15836
|
-
/** forward WebSocket remove event listeners to the current WebSocket instance */
|
|
15837
|
-
removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: ((event: WebSocket.WebSocketEventMap[K]) => void) | {
|
|
15838
|
-
handleEvent(event: WebSocket.WebSocketEventMap[K]): void;
|
|
15839
|
-
}): void;
|
|
15840
15906
|
}
|
|
15841
|
-
type WebSocketEventMap = {
|
|
15842
|
-
open: Event;
|
|
15843
|
-
close: CloseEvent;
|
|
15844
|
-
error: Event;
|
|
15845
|
-
message: MessageEvent;
|
|
15846
|
-
};
|
|
15847
15907
|
//#endregion
|
|
15848
15908
|
//#region src/vars/ComfyVars.d.ts
|
|
15849
15909
|
type VarKind = 'text' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' | 'image';
|
|
@@ -16261,7 +16321,7 @@ type ComfyHostData = {
|
|
|
16261
16321
|
/** extra headers merged into every request + the ws upgrade (Modal-style auth pairs) */
|
|
16262
16322
|
headers?: Record<string, string>;
|
|
16263
16323
|
installType?: ComfyInstallType;
|
|
16264
|
-
onWsMessageAny?: (e:
|
|
16324
|
+
onWsMessageAny?: (e: WsMessageEvent) => void;
|
|
16265
16325
|
onWsMessageArrayBuffer?: (e: ArrayBuffer) => void;
|
|
16266
16326
|
onWsMessageJSON?: (e: WsMsg) => void;
|
|
16267
16327
|
};
|
|
@@ -16421,6 +16481,10 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16421
16481
|
clearQueue: () => Promise<void>;
|
|
16422
16482
|
/** interrupt the CURRENTLY RUNNING prompt */
|
|
16423
16483
|
interrupt: () => Promise<void>;
|
|
16484
|
+
/** delete ONE prompt's server history entry */
|
|
16485
|
+
deleteHistory: (promptId: string) => Promise<void>;
|
|
16486
|
+
/** wipe the server's WHOLE prompt history (every user of that server) */
|
|
16487
|
+
clearHistory: () => Promise<void>;
|
|
16424
16488
|
/** the server's recent console buffer (entries are write CHUNKS, not lines) */
|
|
16425
16489
|
fetchRawLogs: () => Promise<{
|
|
16426
16490
|
entries: LogEntry[];
|
|
@@ -16438,71 +16502,7 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16438
16502
|
/** executions we started */
|
|
16439
16503
|
executions: Map<PromptID, ComfyExecution>;
|
|
16440
16504
|
/** buffer in case we receive packets out of order */
|
|
16441
|
-
_pendingMsgs: Map<PromptID,
|
|
16442
|
-
type: "execution_start";
|
|
16443
|
-
data: {
|
|
16444
|
-
prompt_id: PromptID;
|
|
16445
|
-
};
|
|
16446
|
-
} | {
|
|
16447
|
-
type: "execution_cached";
|
|
16448
|
-
data: {
|
|
16449
|
-
nodes: ComfyNodeId[];
|
|
16450
|
-
prompt_id: PromptID;
|
|
16451
|
-
};
|
|
16452
|
-
} | {
|
|
16453
|
-
type: "executing";
|
|
16454
|
-
data: {
|
|
16455
|
-
prompt_id: PromptID;
|
|
16456
|
-
node?: ComfyNodeId | null | undefined;
|
|
16457
|
-
};
|
|
16458
|
-
} | {
|
|
16459
|
-
type: "progress";
|
|
16460
|
-
data: {
|
|
16461
|
-
value: number;
|
|
16462
|
-
max: number;
|
|
16463
|
-
};
|
|
16464
|
-
} | {
|
|
16465
|
-
type: "progress_state";
|
|
16466
|
-
data: {
|
|
16467
|
-
prompt_id: PromptID;
|
|
16468
|
-
nodes: Record<string, unknown>;
|
|
16469
|
-
};
|
|
16470
|
-
} | {
|
|
16471
|
-
type: "executed";
|
|
16472
|
-
data: {
|
|
16473
|
-
node: ComfyNodeId;
|
|
16474
|
-
output: {
|
|
16475
|
-
previews?: {
|
|
16476
|
-
filepath: string;
|
|
16477
|
-
}[] | undefined;
|
|
16478
|
-
images?: {
|
|
16479
|
-
filename: string;
|
|
16480
|
-
subfolder: string;
|
|
16481
|
-
type: string;
|
|
16482
|
-
}[] | undefined;
|
|
16483
|
-
};
|
|
16484
|
-
prompt_id: PromptID;
|
|
16485
|
-
};
|
|
16486
|
-
} | {
|
|
16487
|
-
type: "execution_error";
|
|
16488
|
-
data: {
|
|
16489
|
-
prompt_id: PromptID;
|
|
16490
|
-
node_id: ComfyNodeId;
|
|
16491
|
-
node_type: string;
|
|
16492
|
-
executed: ComfyNodeId[];
|
|
16493
|
-
exception_message: string;
|
|
16494
|
-
exception_type: string;
|
|
16495
|
-
traceback: string[];
|
|
16496
|
-
current_inputs: Record<string, unknown>;
|
|
16497
|
-
current_outputs: Record<string, unknown>;
|
|
16498
|
-
};
|
|
16499
|
-
} | {
|
|
16500
|
-
type: "execution_success";
|
|
16501
|
-
data: {
|
|
16502
|
-
prompt_id: PromptID;
|
|
16503
|
-
timestamp: number;
|
|
16504
|
-
};
|
|
16505
|
-
})[]>;
|
|
16505
|
+
_pendingMsgs: Map<PromptID, PendingWsItem[]>;
|
|
16506
16506
|
/** the active prompt currently running on this host */
|
|
16507
16507
|
private activePromptID;
|
|
16508
16508
|
/** method to either execute or buffer the incoming message */
|
|
@@ -16542,7 +16542,7 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16542
16542
|
* sockets keep streaming (a half-open socket receives nothing, so this
|
|
16543
16543
|
* never revives one) */
|
|
16544
16544
|
lastWsMessageAt: number | null;
|
|
16545
|
-
onMessage(e:
|
|
16545
|
+
onMessage(e: WsMessageEvent): void;
|
|
16546
16546
|
}
|
|
16547
16547
|
//#endregion
|
|
16548
16548
|
//#region src/litegraph/LiteGraphGroup.d.ts
|
|
@@ -16724,7 +16724,16 @@ type ProgressReport = {
|
|
|
16724
16724
|
};
|
|
16725
16725
|
type ComfyNodeIdMode = 'use_stringified_numbers_only' | 'use_class_name_and_number';
|
|
16726
16726
|
type RunSettings = {
|
|
16727
|
-
|
|
16727
|
+
/** local disk saving is OPT-IN: unset/false keeps outputs in memory only
|
|
16728
|
+
* (`execution.images` buffers); `true` = raw save, an object re-encodes/relocates */
|
|
16729
|
+
save?: boolean | SaveOptions;
|
|
16730
|
+
/** rewrite every SaveImage node to SaveImageWebsocket in the SENT prompt —
|
|
16731
|
+
* outputs never touch the server disk. Implies `scrubHistory` unless that
|
|
16732
|
+
* is explicitly false. (architecture.md item 14) */
|
|
16733
|
+
ephemeral?: boolean;
|
|
16734
|
+
/** delete this run's server history entry (workflow JSON, prompts, filenames)
|
|
16735
|
+
* after `done` — loud but non-fatal on failure */
|
|
16736
|
+
scrubHistory?: boolean;
|
|
16728
16737
|
idMode?: ComfyNodeIdMode;
|
|
16729
16738
|
/** render a live single-line progress report to the console */
|
|
16730
16739
|
log?: boolean;
|
|
@@ -17026,12 +17035,50 @@ type SdkForHost<ID extends string> = [keyof Comfy.Hosts] extends [never] ? Comfy
|
|
|
17026
17035
|
/** the typed node K of host ID (falls back to BaseNode when unknown) */
|
|
17027
17036
|
type NodeOf<ID extends string, K extends string> = SdkForHost<ID>['Node'] extends (infer N) ? K extends keyof N ? N[K] : BaseNode : BaseNode;
|
|
17028
17037
|
//#endregion
|
|
17038
|
+
//#region src/storage/ComfyStorage.d.ts
|
|
17039
|
+
type ComfyStorage = {
|
|
17040
|
+
/** backend name, for error messages */
|
|
17041
|
+
kind: string;
|
|
17042
|
+
/** throws when missing */
|
|
17043
|
+
readText(path: string): string;
|
|
17044
|
+
readTextIfExists(path: string): string | null;
|
|
17045
|
+
/** throws when missing */
|
|
17046
|
+
readBytes(path: string): Uint8Array;
|
|
17047
|
+
/** parents are created (mkdirp implied) */
|
|
17048
|
+
writeText(path: string, text: string): void;
|
|
17049
|
+
/** parents are created (mkdirp implied) */
|
|
17050
|
+
writeBytes(path: string, bytes: Uint8Array): void;
|
|
17051
|
+
exists(path: string): boolean;
|
|
17052
|
+
mkdirp(path: string): void;
|
|
17053
|
+
/** file mtime in ms; null when missing */
|
|
17054
|
+
mtimeMs(path: string): number | null;
|
|
17055
|
+
homedir(): string;
|
|
17056
|
+
cwd(): string;
|
|
17057
|
+
};
|
|
17058
|
+
/** in-memory backend: the web default, also handy for hermetic tests.
|
|
17059
|
+
* Paths are LITERAL keys (no normalization — core callers resolve through
|
|
17060
|
+
* pathe/comfyts already). exists() knows written files and EXPLICIT mkdirp
|
|
17061
|
+
* dirs only, never implicit parents. Bytes are copied in AND out so neither
|
|
17062
|
+
* side can mutate the store. */
|
|
17063
|
+
declare function createMemoryStorage(p?: {
|
|
17064
|
+
homedir?: string;
|
|
17065
|
+
cwd?: string;
|
|
17066
|
+
}): ComfyStorage;
|
|
17067
|
+
/** entries call this at import time: index.ts installs node, web.ts memory */
|
|
17068
|
+
declare function setDefaultComfyStorage(storage: ComfyStorage): void;
|
|
17069
|
+
/** the ONE accessor call sites use: the instance's storage when the global
|
|
17070
|
+
* exists, the resolved default otherwise (vars constructed before create()) */
|
|
17071
|
+
declare function getComfyStorage(): ComfyStorage;
|
|
17072
|
+
//#endregion
|
|
17029
17073
|
//#region src/state.d.ts
|
|
17030
17074
|
/** singleton */
|
|
17031
17075
|
declare class ComfyTS {
|
|
17032
17076
|
version: string;
|
|
17077
|
+
/** the storage seam (architecture item 13): node fs by default, in-memory on web */
|
|
17078
|
+
storage: ComfyStorage;
|
|
17033
17079
|
constructor(p?: {
|
|
17034
17080
|
rootPath?: string;
|
|
17081
|
+
storage?: ComfyStorage;
|
|
17035
17082
|
});
|
|
17036
17083
|
/**
|
|
17037
17084
|
* multi-module entrypoint: returns the existing global instance or creates
|
|
@@ -17040,6 +17087,7 @@ declare class ComfyTS {
|
|
|
17040
17087
|
*/
|
|
17041
17088
|
static create(p?: {
|
|
17042
17089
|
rootPath?: string;
|
|
17090
|
+
storage?: ComfyStorage;
|
|
17043
17091
|
}): ComfyTS;
|
|
17044
17092
|
/** every host created through host(), keyed by id — one instance (and one ws) per id */
|
|
17045
17093
|
hosts: Map<string, ComfyHost>;
|
|
@@ -17053,7 +17101,7 @@ declare class ComfyTS {
|
|
|
17053
17101
|
*/
|
|
17054
17102
|
private _registry;
|
|
17055
17103
|
get registry(): ComfyRegistry;
|
|
17056
|
-
/** root path used to resolve things */
|
|
17104
|
+
/** root path used to resolve things (set in the constructor, storage.cwd() default) */
|
|
17057
17105
|
rootPath: AbsolutePath;
|
|
17058
17106
|
/**
|
|
17059
17107
|
* every repo using comfy-ts gets ONE `.comfy-ts/` folder:
|
|
@@ -17136,16 +17184,6 @@ type AUTO = Branded<{
|
|
|
17136
17184
|
declare const auto: <T>() => T;
|
|
17137
17185
|
declare const auto_: AUTO;
|
|
17138
17186
|
//#endregion
|
|
17139
|
-
//#region src/exampleAssets.d.ts
|
|
17140
|
-
/**
|
|
17141
|
-
* absolute path of a bundled `examples/images/` input image, e.g.
|
|
17142
|
-
* `exampleImagePath('bear_1024x1024.jpg')` — the out-of-the-box default for
|
|
17143
|
-
* i2i/i2v example image vars, valid from this repo AND from a consumer's
|
|
17144
|
-
* node_modules/comfy-ts/. Loud throw naming the path when the file is missing
|
|
17145
|
-
* or the package's examples/ folder was pruned.
|
|
17146
|
-
*/
|
|
17147
|
-
declare function exampleImagePath(name: string): string;
|
|
17148
|
-
//#endregion
|
|
17149
17187
|
//#region src/litegraph/convertFlowToLiteGraphJSON.d.ts
|
|
17150
17188
|
declare const convertFlowToLiteGraphJSON: (graph: ComfyWorkflow) => LiteGraphJSON;
|
|
17151
17189
|
//#endregion
|
|
@@ -17283,9 +17321,6 @@ declare function getLoraKeyword(name: string): string;
|
|
|
17283
17321
|
/** empty keyword deletes the entry; every set writes the file (tiny, rare) */
|
|
17284
17322
|
declare function setLoraKeyword(name: string, keyword: string): void;
|
|
17285
17323
|
//#endregion
|
|
17286
|
-
//#region src/cli/tui-env.d.ts
|
|
17287
|
-
declare function isTuiActive(): boolean;
|
|
17288
|
-
//#endregion
|
|
17289
17324
|
//#region src/utils/loraTag.d.ts
|
|
17290
17325
|
/**
|
|
17291
17326
|
* build a LoraManager-style lora tag: `<lora:name:strength>` or
|
|
@@ -17296,5 +17331,18 @@ declare function isTuiActive(): boolean;
|
|
|
17296
17331
|
*/
|
|
17297
17332
|
declare function loraTag<N extends string = string>(name: N, strength?: number, clipStrength?: number): string;
|
|
17298
17333
|
//#endregion
|
|
17299
|
-
|
|
17334
|
+
//#region src/exampleAssets.d.ts
|
|
17335
|
+
/**
|
|
17336
|
+
* absolute path of a bundled `examples/images/` input image, e.g.
|
|
17337
|
+
* `exampleImagePath('bear_1024x1024.jpg')` — the out-of-the-box default for
|
|
17338
|
+
* i2i/i2v example image vars, valid from this repo AND from a consumer's
|
|
17339
|
+
* node_modules/comfy-ts/. Loud throw naming the path when the file is missing
|
|
17340
|
+
* or the package's examples/ folder was pruned.
|
|
17341
|
+
*/
|
|
17342
|
+
declare function exampleImagePath(name: string): string;
|
|
17343
|
+
//#endregion
|
|
17344
|
+
//#region src/cli/tui-env.d.ts
|
|
17345
|
+
declare function isTuiActive(): boolean;
|
|
17346
|
+
//#endregion
|
|
17347
|
+
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 };
|
|
17300
17348
|
//# sourceMappingURL=index.d.ts.map
|