comfy-ts 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3 -3
- package/dist/index.cjs +33 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +33 -3
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-C1oo5ilG.js → run-serve-CfzOH-AR.js} +5 -1
- package/dist/{run-serve-C1oo5ilG.js.map → run-serve-CfzOH-AR.js.map} +1 -1
- package/dist/{run-tui-CuVst-nc.js → run-tui-_LD0DoGe.js} +2 -2
- package/dist/{run-tui-CuVst-nc.js.map → run-tui-_LD0DoGe.js.map} +1 -1
- package/dist/{state-CvMt0W1-.js → state-C-OOEcp3.js} +33 -3
- package/dist/{state-CvMt0W1-.js.map → state-C-OOEcp3.js.map} +1 -1
- package/dist/web.d.ts +16 -1
- package/dist/web.js +33 -3
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/serve/ServeApp.ts +4 -0
- package/src/coreExports.ts +1 -0
- package/src/host/ComfyHost.ts +50 -2
package/dist/web.d.ts
CHANGED
|
@@ -16340,7 +16340,20 @@ type ConnectOptions = {
|
|
|
16340
16340
|
schema?: 'auto' | 'refresh' | 'cache';
|
|
16341
16341
|
/** max cache age for 'auto' (default 24h) */
|
|
16342
16342
|
maxAgeMs?: number;
|
|
16343
|
+
/**
|
|
16344
|
+
* deadline for the FIRST connect, default 30s. 0 or Infinity waits forever.
|
|
16345
|
+
* A refused TCP connection is a ws CLOSE, not a dead transport, so without a
|
|
16346
|
+
* deadline `connect()` sat in the 2s reconnect loop and never settled: scripts
|
|
16347
|
+
* hung with no error and `comfy-ts serve` wedged the module behind its mutex.
|
|
16348
|
+
* Reconnects AFTER a successful connect are untouched and still retry forever.
|
|
16349
|
+
*/
|
|
16350
|
+
timeoutMs?: number;
|
|
16343
16351
|
};
|
|
16352
|
+
/** the host never came up within ConnectOptions.timeoutMs */
|
|
16353
|
+
declare class ComfyHostUnreachableError extends Error {
|
|
16354
|
+
/** name, not instanceof: the cli bundle and dist/index.js each define this class */
|
|
16355
|
+
readonly name = "ComfyHostUnreachableError";
|
|
16356
|
+
}
|
|
16344
16357
|
type SchemaUpdateResult = Maybe<{
|
|
16345
16358
|
type: 'success';
|
|
16346
16359
|
} | {
|
|
@@ -16458,6 +16471,8 @@ declare class ComfyHost<ID extends string = string> {
|
|
|
16458
16471
|
* - 'cache': never fetch (throws when no cache exists)
|
|
16459
16472
|
*/
|
|
16460
16473
|
connect: (p?: ConnectOptions) => Promise<void>;
|
|
16474
|
+
private _connectTimer;
|
|
16475
|
+
private clearConnectTimer;
|
|
16461
16476
|
/** close the websocket (e.g. to let a script exit) */
|
|
16462
16477
|
disconnect: () => void;
|
|
16463
16478
|
private markReady;
|
|
@@ -17341,5 +17356,5 @@ declare function setLoraKeyword(name: string, keyword: string): void;
|
|
|
17341
17356
|
*/
|
|
17342
17357
|
declare function loraTag<N extends string = string>(name: N, strength?: number, clipStrength?: number): string;
|
|
17343
17358
|
//#endregion
|
|
17344
|
-
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, getComfyStorage, getLoraKeyword, hostIdToNamespace, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
|
|
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 };
|
|
17345
17360
|
//# 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.3.0";
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
107
107
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -4559,6 +4559,14 @@ var DefinedWorkflow = class {
|
|
|
4559
4559
|
};
|
|
4560
4560
|
//#endregion
|
|
4561
4561
|
//#region src/host/ComfyHost.ts
|
|
4562
|
+
/** the host never came up within ConnectOptions.timeoutMs */
|
|
4563
|
+
var ComfyHostUnreachableError = class extends Error {
|
|
4564
|
+
constructor(..._args) {
|
|
4565
|
+
super(..._args);
|
|
4566
|
+
this.name = "ComfyHostUnreachableError";
|
|
4567
|
+
}
|
|
4568
|
+
};
|
|
4569
|
+
const DEFAULT_CONNECT_TIMEOUT_MS = 3e4;
|
|
4562
4570
|
/** auth failure with a SPECIFIC meaning (per the Comfy Cloud error table):
|
|
4563
4571
|
* 401 invalid/missing key · 402 insufficient credits · 429 subscription inactive
|
|
4564
4572
|
* (or plain rate limiting on non-cloud hosts). The key value never appears here. */
|
|
@@ -4708,14 +4716,25 @@ var ComfyHost = class {
|
|
|
4708
4716
|
this._readyResolve = res;
|
|
4709
4717
|
this._readyReject = rej;
|
|
4710
4718
|
});
|
|
4719
|
+
const timeoutMs = p.timeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
|
|
4720
|
+
if (timeoutMs > 0 && Number.isFinite(timeoutMs)) {
|
|
4721
|
+
this._connectTimer = setTimeout(() => {
|
|
4722
|
+
this.markFailed(new ComfyHostUnreachableError(`host '${this.data.id}' did not come up within ${timeoutMs}ms at ${this.getWSUrl()} — is ComfyUI running there ?`));
|
|
4723
|
+
}, timeoutMs);
|
|
4724
|
+
this._connectTimer.unref?.();
|
|
4725
|
+
}
|
|
4711
4726
|
this.initWebsocket();
|
|
4712
4727
|
}
|
|
4713
4728
|
return this._ready;
|
|
4714
4729
|
};
|
|
4730
|
+
this._connectTimer = null;
|
|
4715
4731
|
this.disconnect = () => {
|
|
4732
|
+
this.clearConnectTimer();
|
|
4716
4733
|
this.ws?.disconnectPermanently();
|
|
4717
4734
|
this.ws = null;
|
|
4718
4735
|
this._ready = null;
|
|
4736
|
+
this._readyResolve = null;
|
|
4737
|
+
this._readyReject = null;
|
|
4719
4738
|
};
|
|
4720
4739
|
this.ws = null;
|
|
4721
4740
|
this._sessionResolve = null;
|
|
@@ -4860,15 +4879,26 @@ var ComfyHost = class {
|
|
|
4860
4879
|
get isConnected() {
|
|
4861
4880
|
return this.ws?.isOpen ?? false;
|
|
4862
4881
|
}
|
|
4882
|
+
clearConnectTimer() {
|
|
4883
|
+
if (this._connectTimer != null) clearTimeout(this._connectTimer);
|
|
4884
|
+
this._connectTimer = null;
|
|
4885
|
+
}
|
|
4863
4886
|
markReady() {
|
|
4887
|
+
this.clearConnectTimer();
|
|
4864
4888
|
this._readyResolve?.();
|
|
4865
4889
|
this._readyResolve = null;
|
|
4866
4890
|
this._readyReject = null;
|
|
4867
4891
|
}
|
|
4868
4892
|
markFailed(error) {
|
|
4869
|
-
this.
|
|
4893
|
+
this.clearConnectTimer();
|
|
4894
|
+
const reject = this._readyReject;
|
|
4895
|
+
if (reject == null) return;
|
|
4870
4896
|
this._readyResolve = null;
|
|
4871
4897
|
this._readyReject = null;
|
|
4898
|
+
this._ready = null;
|
|
4899
|
+
this.ws?.disconnectPermanently();
|
|
4900
|
+
this.ws = null;
|
|
4901
|
+
reject(error);
|
|
4872
4902
|
}
|
|
4873
4903
|
async writeSDKToDisk() {
|
|
4874
4904
|
if (this.data.sdkAutoWrite === false) return;
|
|
@@ -5727,6 +5757,6 @@ function loraTag(name, strength = 1, clipStrength) {
|
|
|
5727
5757
|
*/
|
|
5728
5758
|
setDefaultComfyStorage(createMemoryStorage());
|
|
5729
5759
|
//#endregion
|
|
5730
|
-
export { ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, 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 };
|
|
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 };
|
|
5731
5761
|
|
|
5732
5762
|
//# sourceMappingURL=web.js.map
|