comfy-ts 2.4.1 → 2.5.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.
Files changed (33) hide show
  1. package/dist/{DefinedWorkflow-QrhT6V66.js → DefinedWorkflow-CnzmQrBh.js} +45 -13
  2. package/dist/DefinedWorkflow-CnzmQrBh.js.map +1 -0
  3. package/dist/{DraftsSt-D9Fhk4qR.js → DraftsSt-C1MbWnEp.js} +2 -2
  4. package/dist/{DraftsSt-D9Fhk4qR.js.map → DraftsSt-C1MbWnEp.js.map} +1 -1
  5. package/dist/cli.js +18 -11
  6. package/dist/cli.js.map +1 -1
  7. package/dist/index.cjs +30 -14
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +27 -23
  10. package/dist/index.d.ts +27 -23
  11. package/dist/index.js +30 -15
  12. package/dist/index.js.map +1 -1
  13. package/dist/{run-serve-C9E8dyLP.js → run-serve-D47Zas-a.js} +3 -3
  14. package/dist/{run-serve-C9E8dyLP.js.map → run-serve-D47Zas-a.js.map} +1 -1
  15. package/dist/{run-tui-8si-rVW0.js → run-tui-t2TRBN0H.js} +24 -15
  16. package/dist/run-tui-t2TRBN0H.js.map +1 -0
  17. package/dist/{state-C0ARiFFM.js → state-DY3Mp9Cl.js} +3 -3
  18. package/dist/{state-C0ARiFFM.js.map → state-DY3Mp9Cl.js.map} +1 -1
  19. package/dist/web.d.ts +27 -23
  20. package/dist/web.js +30 -15
  21. package/dist/web.js.map +1 -1
  22. package/package.json +3 -3
  23. package/src/cli/loras.ts +20 -9
  24. package/src/cli/tui/components/TuiApp.tsx +1 -1
  25. package/src/cli/tui/protocolImagePainter.ts +1 -1
  26. package/src/cli/tui/state/ExecSt.ts +3 -3
  27. package/src/cli/tui/state/LorasSt.ts +19 -5
  28. package/src/cli/tui/state/TuiSt.ts +4 -4
  29. package/src/coreExports.ts +1 -0
  30. package/src/host/loraInfoCache.ts +34 -13
  31. package/src/host/loraManagerApi.ts +25 -4
  32. package/dist/DefinedWorkflow-QrhT6V66.js.map +0 -1
  33. package/dist/run-tui-8si-rVW0.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -11900,27 +11900,27 @@ declare const types$1: import("arktype").Module<{
11900
11900
  };
11901
11901
  PromptID: PromptID;
11902
11902
  PromptRelated_WsMsg: {
11903
- type: "execution_start";
11903
+ type: "progress";
11904
11904
  data: {
11905
- prompt_id: PromptID;
11905
+ value: number;
11906
+ max: number;
11906
11907
  };
11907
11908
  } | {
11908
- type: "execution_cached";
11909
+ type: "executing";
11909
11910
  data: {
11910
- nodes: ComfyNodeId[];
11911
11911
  prompt_id: PromptID;
11912
+ node?: ComfyNodeId | null | undefined;
11912
11913
  };
11913
11914
  } | {
11914
- type: "executing";
11915
+ type: "execution_cached";
11915
11916
  data: {
11917
+ nodes: ComfyNodeId[];
11916
11918
  prompt_id: PromptID;
11917
- node?: ComfyNodeId | null | undefined;
11918
11919
  };
11919
11920
  } | {
11920
- type: "progress";
11921
+ type: "execution_start";
11921
11922
  data: {
11922
- value: number;
11923
- max: number;
11923
+ prompt_id: PromptID;
11924
11924
  };
11925
11925
  } | {
11926
11926
  type: "progress_state";
@@ -11975,27 +11975,27 @@ declare const types$1: import("arktype").Module<{
11975
11975
  data: string;
11976
11976
  };
11977
11977
  WsMsg: {
11978
- type: "execution_start";
11978
+ type: "progress";
11979
11979
  data: {
11980
- prompt_id: PromptID;
11980
+ value: number;
11981
+ max: number;
11981
11982
  };
11982
11983
  } | {
11983
- type: "execution_cached";
11984
+ type: "executing";
11984
11985
  data: {
11985
- nodes: ComfyNodeId[];
11986
11986
  prompt_id: PromptID;
11987
+ node?: ComfyNodeId | null | undefined;
11987
11988
  };
11988
11989
  } | {
11989
- type: "executing";
11990
+ type: "execution_cached";
11990
11991
  data: {
11992
+ nodes: ComfyNodeId[];
11991
11993
  prompt_id: PromptID;
11992
- node?: ComfyNodeId | null | undefined;
11993
11994
  };
11994
11995
  } | {
11995
- type: "progress";
11996
+ type: "execution_start";
11996
11997
  data: {
11997
- value: number;
11998
- max: number;
11998
+ prompt_id: PromptID;
11999
11999
  };
12000
12000
  } | {
12001
12001
  type: "progress_state";
@@ -17453,10 +17453,14 @@ type LoraMirror = {
17453
17453
  loras: Record<string, LmLoraItem>;
17454
17454
  };
17455
17455
  /**
17456
- * forget everything loaded, so the next read picks up a fresh `comfy-ts loras`.
17457
- * A long-lived process (the TUI, `comfy-ts serve`) has no other way to see a
17458
- * re-sync that happened in another terminal.
17459
- */
17456
+ * re-read any mirror whose file changed (or appeared) since we loaded it.
17457
+ * `comfy-ts loras` in another terminal is the normal case, and without this a
17458
+ * TUI session kept the stale data — or kept knowing NOTHING, for a host whose
17459
+ * first sync happened while it was open. One stat per registered host, so this
17460
+ * belongs at user-initiated moments (opening the loras overlay), never in a render.
17461
+ */
17462
+ declare function refreshLoraInfoCacheIfChanged(): void;
17463
+ /** forget everything loaded, so the next read re-reads from disk (tests, and a hard refresh) */
17460
17464
  declare function reloadLoraInfoCache(): void;
17461
17465
  /**
17462
17466
  * the lm item for a raw lora name (`styles\x.safetensors`).
@@ -17510,5 +17514,5 @@ declare function exampleImagePath(name: string): string;
17510
17514
  //#region src/cli/tui-env.d.ts
17511
17515
  declare function isTuiActive(): boolean;
17512
17516
  //#endregion
17513
- 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 };
17517
+ 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, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
17514
17518
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -11900,27 +11900,27 @@ declare const types$1: import("arktype").Module<{
11900
11900
  };
11901
11901
  PromptID: PromptID;
11902
11902
  PromptRelated_WsMsg: {
11903
- type: "execution_start";
11903
+ type: "progress";
11904
11904
  data: {
11905
- prompt_id: PromptID;
11905
+ value: number;
11906
+ max: number;
11906
11907
  };
11907
11908
  } | {
11908
- type: "execution_cached";
11909
+ type: "executing";
11909
11910
  data: {
11910
- nodes: ComfyNodeId[];
11911
11911
  prompt_id: PromptID;
11912
+ node?: ComfyNodeId | null | undefined;
11912
11913
  };
11913
11914
  } | {
11914
- type: "executing";
11915
+ type: "execution_cached";
11915
11916
  data: {
11917
+ nodes: ComfyNodeId[];
11916
11918
  prompt_id: PromptID;
11917
- node?: ComfyNodeId | null | undefined;
11918
11919
  };
11919
11920
  } | {
11920
- type: "progress";
11921
+ type: "execution_start";
11921
11922
  data: {
11922
- value: number;
11923
- max: number;
11923
+ prompt_id: PromptID;
11924
11924
  };
11925
11925
  } | {
11926
11926
  type: "progress_state";
@@ -11975,27 +11975,27 @@ declare const types$1: import("arktype").Module<{
11975
11975
  data: string;
11976
11976
  };
11977
11977
  WsMsg: {
11978
- type: "execution_start";
11978
+ type: "progress";
11979
11979
  data: {
11980
- prompt_id: PromptID;
11980
+ value: number;
11981
+ max: number;
11981
11982
  };
11982
11983
  } | {
11983
- type: "execution_cached";
11984
+ type: "executing";
11984
11985
  data: {
11985
- nodes: ComfyNodeId[];
11986
11986
  prompt_id: PromptID;
11987
+ node?: ComfyNodeId | null | undefined;
11987
11988
  };
11988
11989
  } | {
11989
- type: "executing";
11990
+ type: "execution_cached";
11990
11991
  data: {
11992
+ nodes: ComfyNodeId[];
11991
11993
  prompt_id: PromptID;
11992
- node?: ComfyNodeId | null | undefined;
11993
11994
  };
11994
11995
  } | {
11995
- type: "progress";
11996
+ type: "execution_start";
11996
11997
  data: {
11997
- value: number;
11998
- max: number;
11998
+ prompt_id: PromptID;
11999
11999
  };
12000
12000
  } | {
12001
12001
  type: "progress_state";
@@ -17453,10 +17453,14 @@ type LoraMirror = {
17453
17453
  loras: Record<string, LmLoraItem>;
17454
17454
  };
17455
17455
  /**
17456
- * forget everything loaded, so the next read picks up a fresh `comfy-ts loras`.
17457
- * A long-lived process (the TUI, `comfy-ts serve`) has no other way to see a
17458
- * re-sync that happened in another terminal.
17459
- */
17456
+ * re-read any mirror whose file changed (or appeared) since we loaded it.
17457
+ * `comfy-ts loras` in another terminal is the normal case, and without this a
17458
+ * TUI session kept the stale data — or kept knowing NOTHING, for a host whose
17459
+ * first sync happened while it was open. One stat per registered host, so this
17460
+ * belongs at user-initiated moments (opening the loras overlay), never in a render.
17461
+ */
17462
+ declare function refreshLoraInfoCacheIfChanged(): void;
17463
+ /** forget everything loaded, so the next read re-reads from disk (tests, and a hard refresh) */
17460
17464
  declare function reloadLoraInfoCache(): void;
17461
17465
  /**
17462
17466
  * the lm item for a raw lora name (`styles\x.safetensors`).
@@ -17510,5 +17514,5 @@ declare function exampleImagePath(name: string): string;
17510
17514
  //#region src/cli/tui-env.d.ts
17511
17515
  declare function isTuiActive(): boolean;
17512
17516
  //#endregion
17513
- 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 };
17517
+ 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, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
17514
17518
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -110,7 +110,7 @@ function createNodeStorage() {
110
110
  }
111
111
  //#endregion
112
112
  //#region package.json
113
- var version = "2.4.1";
113
+ var version = "2.5.0";
114
114
  //#endregion
115
115
  //#region src/litegraph/LiteGraphLinkID.ts
116
116
  const asLiteGraphLinkID = (id) => id;
@@ -3997,25 +3997,40 @@ function readLoraMirror(hostId) {
3997
3997
  * `comfyts.hosts` — exactly the hosts this process can be asked about.
3998
3998
  */
3999
3999
  const byHost = /* @__PURE__ */ new Map();
4000
- /** hosts already looked for, INCLUDING the ones with no mirror (see reloadLoraInfoCache) */
4001
- const loadedHostIds = /* @__PURE__ */ new Set();
4000
+ /** hosts already looked for, INCLUDING the ones with no mirror on disk → their mtime is null */
4001
+ const loadedMtimes = /* @__PURE__ */ new Map();
4002
+ /** cheap: no stat, no parse — this runs inside the overlay's render for every row */
4002
4003
  function ensureLoaded() {
4003
- for (const hostId of comfyts.hosts.keys()) {
4004
- if (loadedHostIds.has(hostId)) continue;
4005
- loadedHostIds.add(hostId);
4006
- const mirror = readLoraMirror(hostId);
4007
- if (mirror == null) continue;
4008
- byHost.set(hostId, new Map(Object.entries(mirror.loras)));
4009
- }
4004
+ for (const hostId of comfyts.hosts.keys()) if (!loadedMtimes.has(hostId)) loadHost(hostId);
4005
+ }
4006
+ function loadHost(hostId) {
4007
+ const storage = getComfyStorage();
4008
+ const path = loraMirrorPath(hostId);
4009
+ loadedMtimes.set(hostId, storage.mtimeMs(path));
4010
+ const mirror = readLoraMirror(hostId);
4011
+ if (mirror != null) byHost.set(hostId, new Map(Object.entries(mirror.loras)));
4012
+ else if (storage.exists(path)) byHost.set(hostId, /* @__PURE__ */ new Map());
4013
+ else byHost.delete(hostId);
4010
4014
  }
4011
4015
  /**
4012
- * forget everything loaded, so the next read picks up a fresh `comfy-ts loras`.
4013
- * A long-lived process (the TUI, `comfy-ts serve`) has no other way to see a
4014
- * re-sync that happened in another terminal.
4016
+ * re-read any mirror whose file changed (or appeared) since we loaded it.
4017
+ * `comfy-ts loras` in another terminal is the normal case, and without this a
4018
+ * TUI session kept the stale data — or kept knowing NOTHING, for a host whose
4019
+ * first sync happened while it was open. One stat per registered host, so this
4020
+ * belongs at user-initiated moments (opening the loras overlay), never in a render.
4015
4021
  */
4022
+ function refreshLoraInfoCacheIfChanged() {
4023
+ const storage = getComfyStorage();
4024
+ for (const hostId of comfyts.hosts.keys()) {
4025
+ const seen = loadedMtimes.get(hostId);
4026
+ const now = storage.mtimeMs(loraMirrorPath(hostId));
4027
+ if (!loadedMtimes.has(hostId) || seen !== now) loadHost(hostId);
4028
+ }
4029
+ }
4030
+ /** forget everything loaded, so the next read re-reads from disk (tests, and a hard refresh) */
4016
4031
  function reloadLoraInfoCache() {
4017
4032
  byHost.clear();
4018
- loadedHostIds.clear();
4033
+ loadedMtimes.clear();
4019
4034
  }
4020
4035
  /**
4021
4036
  * the lm item for a raw lora name (`styles\x.safetensors`).
@@ -6047,6 +6062,6 @@ function isTuiActive() {
6047
6062
  */
6048
6063
  setDefaultComfyStorage(createNodeStorage());
6049
6064
  //#endregion
6050
- 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, exampleImagePath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
6065
+ 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, exampleImagePath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, v };
6051
6066
 
6052
6067
  //# sourceMappingURL=index.js.map