comfy-ts 2.24.0 → 2.25.1
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/chunk-6mgjbrp6.js +579 -0
- package/dist/chunk-6mgjbrp6.js.map +17 -0
- package/dist/chunk-6tsg7fm5.js +1876 -0
- package/dist/chunk-6tsg7fm5.js.map +31 -0
- package/dist/chunk-dvxjvwe7.js +2593 -0
- package/dist/chunk-dvxjvwe7.js.map +29 -0
- package/dist/chunk-dw0t1nye.js +457 -0
- package/dist/chunk-dw0t1nye.js.map +16 -0
- package/dist/chunk-he70ewwx.js +444 -0
- package/dist/chunk-he70ewwx.js.map +13 -0
- package/dist/chunk-n22qz0j1.js +6663 -0
- package/dist/chunk-n22qz0j1.js.map +95 -0
- package/dist/chunk-n35nffm8.js +4777 -0
- package/dist/chunk-n35nffm8.js.map +51 -0
- package/dist/cli/serve/hostProtocol.d.cts +74 -0
- package/dist/cli/serve/hostProtocol.d.ts +74 -0
- package/dist/cli/tui-env.d.cts +2 -0
- package/dist/cli/tui-env.d.ts +2 -0
- package/dist/cli.js +494 -485
- package/dist/cli.js.map +16 -1
- package/dist/coreExports.d.cts +45 -0
- package/dist/coreExports.d.ts +45 -0
- package/dist/errors/InvalidPromptError.d.cts +10 -0
- package/dist/errors/InvalidPromptError.d.ts +10 -0
- package/dist/exampleAssets.d.cts +24 -0
- package/dist/exampleAssets.d.ts +24 -0
- package/dist/graph/ComfyNode.d.cts +109 -0
- package/dist/graph/ComfyNode.d.ts +109 -0
- package/dist/graph/ComfyNodeID.d.cts +15 -0
- package/dist/graph/ComfyNodeID.d.ts +15 -0
- package/dist/graph/ComfyNodeOutput.d.cts +21 -0
- package/dist/graph/ComfyNodeOutput.d.ts +21 -0
- package/dist/graph/NodeSlotSize.d.cts +4 -0
- package/dist/graph/NodeSlotSize.d.ts +4 -0
- package/dist/graph/autoValue.d.cts +16 -0
- package/dist/graph/autoValue.d.ts +16 -0
- package/dist/host/ComfyHost.d.cts +383 -0
- package/dist/host/ComfyHost.d.ts +383 -0
- package/dist/host/ComfyInstallType.d.cts +11 -0
- package/dist/host/ComfyInstallType.d.ts +11 -0
- package/dist/host/ComfyManager.d.cts +152 -0
- package/dist/host/ComfyManager.d.ts +152 -0
- package/dist/host/ComfyUploader.d.cts +42 -0
- package/dist/host/ComfyUploader.d.ts +42 -0
- package/dist/host/ComfyWorkflowBuilder.d.cts +19 -0
- package/dist/host/ComfyWorkflowBuilder.d.ts +19 -0
- package/dist/host/Requirements.d.cts +43 -0
- package/dist/host/Requirements.d.ts +43 -0
- package/dist/host/ResilientWebsocket.d.cts +122 -0
- package/dist/host/ResilientWebsocket.d.ts +122 -0
- package/dist/host/hostFile.d.cts +23 -0
- package/dist/host/hostFile.d.ts +23 -0
- package/dist/host/hostUrl.d.cts +22 -0
- package/dist/host/hostUrl.d.ts +22 -0
- package/dist/host/leastBusy.d.cts +9 -0
- package/dist/host/leastBusy.d.ts +9 -0
- package/dist/host/loraInfoCache.d.cts +110 -0
- package/dist/host/loraInfoCache.d.ts +110 -0
- package/dist/host/loraManagerApi.d.cts +106 -0
- package/dist/host/loraManagerApi.d.ts +106 -0
- package/dist/host/previewMethod.d.cts +5 -0
- package/dist/host/previewMethod.d.ts +5 -0
- package/dist/host/schemaDrift.d.cts +54 -0
- package/dist/host/schemaDrift.d.ts +54 -0
- package/dist/image-utils/_getPngMetadata.d.cts +5 -0
- package/dist/image-utils/_getPngMetadata.d.ts +5 -0
- package/dist/index.cjs +8197 -8509
- package/dist/index.cjs.map +124 -1
- package/dist/index.d.cts +4 -19116
- package/dist/index.d.ts +4 -19116
- package/dist/index.js +8129 -8390
- package/dist/index.js.map +124 -1
- package/dist/litegraph/CanonicalWorkflow.d.cts +75 -0
- package/dist/litegraph/CanonicalWorkflow.d.ts +75 -0
- package/dist/litegraph/LiteGraphGroup.d.cts +17 -0
- package/dist/litegraph/LiteGraphGroup.d.ts +17 -0
- package/dist/litegraph/LiteGraphJSON.d.cts +242 -0
- package/dist/litegraph/LiteGraphJSON.d.ts +242 -0
- package/dist/litegraph/LiteGraphLink.d.cts +48 -0
- package/dist/litegraph/LiteGraphLink.d.ts +48 -0
- package/dist/litegraph/LiteGraphLinkID.d.cts +6 -0
- package/dist/litegraph/LiteGraphLinkID.d.ts +6 -0
- package/dist/litegraph/LiteGraphNode.d.cts +76 -0
- package/dist/litegraph/LiteGraphNode.d.ts +76 -0
- package/dist/litegraph/LiteGraphNodeInput.d.cts +25 -0
- package/dist/litegraph/LiteGraphNodeInput.d.ts +25 -0
- package/dist/litegraph/LiteGraphNodeOutput.d.cts +20 -0
- package/dist/litegraph/LiteGraphNodeOutput.d.ts +20 -0
- package/dist/litegraph/LiteGraphSlotIndex.d.cts +6 -0
- package/dist/litegraph/LiteGraphSlotIndex.d.ts +6 -0
- package/dist/litegraph/LiteGraphSubgraphDef.d.cts +174 -0
- package/dist/litegraph/LiteGraphSubgraphDef.d.ts +174 -0
- package/dist/litegraph/convertFlowToLiteGraphJSON.d.cts +12 -0
- package/dist/litegraph/convertFlowToLiteGraphJSON.d.ts +12 -0
- package/dist/litegraph/expandSubgraphs.d.cts +27 -0
- package/dist/litegraph/expandSubgraphs.d.ts +27 -0
- package/dist/litegraph/normalizeWorkflow.d.cts +21 -0
- package/dist/litegraph/normalizeWorkflow.d.ts +21 -0
- package/dist/manager/ComfyRegistry.d.cts +54 -0
- package/dist/manager/ComfyRegistry.d.ts +54 -0
- package/dist/manager/generated/KnownComfyCustomNodeName.d.cts +1 -0
- package/dist/manager/generated/KnownComfyCustomNodeName.d.ts +1 -0
- package/dist/manager/generated/KnownComfyPluginTitle.d.cts +12109 -0
- package/dist/manager/generated/KnownComfyPluginTitle.d.ts +12109 -0
- package/dist/manager/generated/KnownComfyPluginURL.d.cts +1 -0
- package/dist/manager/generated/KnownComfyPluginURL.d.ts +1 -0
- package/dist/manager/generated/KnownModel_Base.d.cts +2 -0
- package/dist/manager/generated/KnownModel_Base.d.ts +2 -0
- package/dist/manager/generated/KnownModel_Name.d.cts +2842 -0
- package/dist/manager/generated/KnownModel_Name.d.ts +2842 -0
- package/dist/manager/generated/KnownModel_SavePath.d.cts +2 -0
- package/dist/manager/generated/KnownModel_SavePath.d.ts +2 -0
- package/dist/manager/generated/KnownModel_Type.d.cts +2 -0
- package/dist/manager/generated/KnownModel_Type.d.ts +2 -0
- package/dist/manager/installedView.d.cts +65 -0
- package/dist/manager/installedView.d.ts +65 -0
- package/dist/manager/json/custom-node-list.extra.d.cts +2 -0
- package/dist/manager/json/custom-node-list.extra.d.ts +2 -0
- package/dist/manager/json/model-list.extra.d.cts +2 -0
- package/dist/manager/json/model-list.extra.d.ts +2 -0
- package/dist/manager/loaders/parseReport.d.cts +24 -0
- package/dist/manager/loaders/parseReport.d.ts +24 -0
- package/dist/manager/loaders/step1_downloadComfyManagerJSONs.d.cts +1 -0
- package/dist/manager/loaders/step1_downloadComfyManagerJSONs.d.ts +1 -0
- package/dist/manager/loaders/step2_custom-node-list-loader.d.cts +2 -0
- package/dist/manager/loaders/step2_custom-node-list-loader.d.ts +2 -0
- package/dist/manager/loaders/step3_extension-node-map-loader.d.cts +2 -0
- package/dist/manager/loaders/step3_extension-node-map-loader.d.ts +2 -0
- package/dist/manager/loaders/step4_model-list-loader.d.cts +2 -0
- package/dist/manager/loaders/step4_model-list-loader.d.ts +2 -0
- package/dist/manager/loaders/step5_alter-list-loader.d.cts +2 -0
- package/dist/manager/loaders/step5_alter-list-loader.d.ts +2 -0
- package/dist/manager/loaders/step6_github-stats-loader.d.cts +2 -0
- package/dist/manager/loaders/step6_github-stats-loader.d.ts +2 -0
- package/dist/manager/types/ComfyManagerAPIFetchPolicy.d.cts +7 -0
- package/dist/manager/types/ComfyManagerAPIFetchPolicy.d.ts +7 -0
- package/dist/manager/types/ComfyManagerAPIModelList.d.cts +10 -0
- package/dist/manager/types/ComfyManagerAPIModelList.d.ts +10 -0
- package/dist/manager/types/ComfyManagerAPIPluginList.d.cts +33 -0
- package/dist/manager/types/ComfyManagerAPIPluginList.d.ts +33 -0
- package/dist/manager/types/ComfyManagerAlterInfo.d.cts +12 -0
- package/dist/manager/types/ComfyManagerAlterInfo.d.ts +12 -0
- package/dist/manager/types/ComfyManagerFileModelInfo.d.cts +10 -0
- package/dist/manager/types/ComfyManagerFileModelInfo.d.ts +10 -0
- package/dist/manager/types/ComfyManagerFilePluginContent.d.cts +11 -0
- package/dist/manager/types/ComfyManagerFilePluginContent.d.ts +11 -0
- package/dist/manager/types/ComfyManagerFilePluginList.d.cts +5 -0
- package/dist/manager/types/ComfyManagerFilePluginList.d.ts +5 -0
- package/dist/manager/types/ComfyManagerGithubStats.d.cts +7 -0
- package/dist/manager/types/ComfyManagerGithubStats.d.ts +7 -0
- package/dist/manager/types/ComfyManagerModelInfo.d.cts +12 -0
- package/dist/manager/types/ComfyManagerModelInfo.d.ts +12 -0
- package/dist/manager/types/ComfyManagerPluginContentMetadata.d.cts +10 -0
- package/dist/manager/types/ComfyManagerPluginContentMetadata.d.ts +10 -0
- package/dist/manager/types/ComfyManagerPluginEnums.d.cts +5 -0
- package/dist/manager/types/ComfyManagerPluginEnums.d.ts +5 -0
- package/dist/manager/types/ComfyManagerPluginInfo.d.cts +54 -0
- package/dist/manager/types/ComfyManagerPluginInfo.d.ts +54 -0
- package/dist/promptEnhancers.d.cts +22 -0
- package/dist/promptEnhancers.d.ts +22 -0
- package/dist/runner/ComfyExecution.d.cts +230 -0
- package/dist/runner/ComfyExecution.d.ts +230 -0
- package/dist/runner/ComfyExecutionStatus.d.cts +1 -0
- package/dist/runner/ComfyExecutionStatus.d.ts +1 -0
- package/dist/runner/ComfyWorkflow.d.cts +141 -0
- package/dist/runner/ComfyWorkflow.d.ts +141 -0
- package/dist/runner/ComfyWorkflowLayout.d.cts +17 -0
- package/dist/runner/ComfyWorkflowLayout.d.ts +17 -0
- package/dist/runner/ComfyWsApi.d.cts +2174 -0
- package/dist/runner/ComfyWsApi.d.ts +2174 -0
- package/dist/runner/MediaImage.d.cts +127 -0
- package/dist/runner/MediaImage.d.ts +127 -0
- package/dist/runner/comfyOrgApiKey.d.cts +21 -0
- package/dist/runner/comfyOrgApiKey.d.ts +21 -0
- package/dist/runner/describePromptRejection.d.cts +1 -0
- package/dist/runner/describePromptRejection.d.ts +1 -0
- package/dist/runner/ephemeral.d.cts +10 -0
- package/dist/runner/ephemeral.d.ts +10 -0
- package/dist/runner/historyReplay.d.cts +13 -0
- package/dist/runner/historyReplay.d.ts +13 -0
- package/dist/runner/mediaKinds.d.cts +7 -0
- package/dist/runner/mediaKinds.d.ts +7 -0
- package/dist/runner/outputPath.d.cts +40 -0
- package/dist/runner/outputPath.d.ts +40 -0
- package/dist/runner/outputs3d.d.cts +3 -0
- package/dist/runner/outputs3d.d.ts +3 -0
- package/dist/runner/wsBinaryFrame.d.cts +25 -0
- package/dist/runner/wsBinaryFrame.d.ts +25 -0
- package/dist/sdk-generator/ComfyNodeSchema.d.cts +25 -0
- package/dist/sdk-generator/ComfyNodeSchema.d.ts +25 -0
- package/dist/sdk-generator/ComfySchema.d.cts +74 -0
- package/dist/sdk-generator/ComfySchema.d.ts +74 -0
- package/dist/sdk-generator/ComfyUIObjectInfoTypes.d.cts +3072 -0
- package/dist/sdk-generator/ComfyUIObjectInfoTypes.d.ts +3072 -0
- package/dist/sdk-generator/Primitives.d.cts +12 -0
- package/dist/sdk-generator/Primitives.d.ts +12 -0
- package/dist/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.d.cts +2 -0
- package/dist/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.d.ts +2 -0
- package/dist/sdk-generator/_pythonModuleToNamespace.d.cts +1 -0
- package/dist/sdk-generator/_pythonModuleToNamespace.d.ts +1 -0
- package/dist/sdk-generator/_toQualifiedNodeKey.d.cts +1 -0
- package/dist/sdk-generator/_toQualifiedNodeKey.d.ts +1 -0
- package/dist/sdk-generator/comfy-api-json.d.cts +16 -0
- package/dist/sdk-generator/comfy-api-json.d.ts +16 -0
- package/dist/sdk-generator/comfyui-sdk-codegen.d.cts +23 -0
- package/dist/sdk-generator/comfyui-sdk-codegen.d.ts +23 -0
- package/dist/sdk-generator/comfyui-types.d.cts +55 -0
- package/dist/sdk-generator/comfyui-types.d.ts +55 -0
- package/dist/sdk-generator/inputWidgetKind.d.cts +80 -0
- package/dist/sdk-generator/inputWidgetKind.d.ts +80 -0
- package/dist/sdk-generator/litegraphToApiRequestPayload.d.cts +41 -0
- package/dist/sdk-generator/litegraphToApiRequestPayload.d.ts +41 -0
- package/dist/serve-web.js +51 -51
- package/dist/ssh-host-manager/ssh-config-manager.d.cts +17 -0
- package/dist/ssh-host-manager/ssh-config-manager.d.ts +17 -0
- package/dist/state.d.cts +80 -0
- package/dist/state.d.ts +80 -0
- package/dist/storage/ComfyStorage.d.cts +55 -0
- package/dist/storage/ComfyStorage.d.ts +55 -0
- package/dist/storage/nodeStorage.d.cts +2 -0
- package/dist/storage/nodeStorage.d.ts +2 -0
- package/dist/types/comfy-sdk.d.cts +85 -0
- package/dist/types/comfy-sdk.d.ts +85 -0
- package/dist/types/index.d.cts +65 -0
- package/dist/types/index.d.ts +65 -0
- package/dist/utils/CodeBuffer.d.cts +20 -0
- package/dist/utils/CodeBuffer.d.ts +20 -0
- package/dist/utils/ComfyColors.d.cts +14 -0
- package/dist/utils/ComfyColors.d.ts +14 -0
- package/dist/utils/ansi.d.cts +22 -0
- package/dist/utils/ansi.d.ts +22 -0
- package/dist/utils/bang.d.cts +9 -0
- package/dist/utils/bang.d.ts +9 -0
- package/dist/utils/deepCopyNaive.d.cts +1 -0
- package/dist/utils/deepCopyNaive.d.ts +1 -0
- package/dist/utils/downloadFile.d.cts +2 -0
- package/dist/utils/downloadFile.d.ts +2 -0
- package/dist/utils/escapeJSKey.d.cts +2 -0
- package/dist/utils/escapeJSKey.d.ts +2 -0
- package/dist/utils/exhaust.d.cts +1 -0
- package/dist/utils/exhaust.d.ts +1 -0
- package/dist/utils/extractErrorMessage.d.cts +2 -0
- package/dist/utils/extractErrorMessage.d.ts +2 -0
- package/dist/utils/githubRegexes.d.cts +2 -0
- package/dist/utils/githubRegexes.d.ts +2 -0
- package/dist/utils/hashArrayBuffer.d.cts +1 -0
- package/dist/utils/hashArrayBuffer.d.ts +1 -0
- package/dist/utils/isRecord.d.cts +2 -0
- package/dist/utils/isRecord.d.ts +2 -0
- package/dist/utils/lazySharp.d.cts +3 -0
- package/dist/utils/lazySharp.d.ts +3 -0
- package/dist/utils/log.d.cts +4 -0
- package/dist/utils/log.d.ts +4 -0
- package/dist/utils/loraTag.d.cts +8 -0
- package/dist/utils/loraTag.d.ts +8 -0
- package/dist/utils/matchesRegex.d.cts +2 -0
- package/dist/utils/matchesRegex.d.ts +2 -0
- package/dist/utils/printArkResultInConsole.d.cts +2 -0
- package/dist/utils/printArkResultInConsole.d.ts +2 -0
- package/dist/utils/safeName.d.cts +6 -0
- package/dist/utils/safeName.d.ts +6 -0
- package/dist/utils/sha1.d.cts +2 -0
- package/dist/utils/sha1.d.ts +2 -0
- package/dist/utils/softValidate.d.cts +2 -0
- package/dist/utils/softValidate.d.ts +2 -0
- package/dist/utils/stringifyReadable.d.cts +1 -0
- package/dist/utils/stringifyReadable.d.ts +1 -0
- package/dist/utils/toposort.d.cts +3 -0
- package/dist/utils/toposort.d.ts +3 -0
- package/dist/vars/ComfyVars.d.cts +607 -0
- package/dist/vars/ComfyVars.d.ts +607 -0
- package/dist/vars/DefinedWorkflow.d.cts +104 -0
- package/dist/vars/DefinedWorkflow.d.ts +104 -0
- package/dist/vars/lanes.d.cts +81 -0
- package/dist/vars/lanes.d.ts +81 -0
- package/dist/vars/loraEntry.d.cts +26 -0
- package/dist/vars/loraEntry.d.ts +26 -0
- package/dist/vars/loraKeywords.d.cts +19 -0
- package/dist/vars/loraKeywords.d.ts +19 -0
- package/dist/vars/outputWidgets.d.cts +33 -0
- package/dist/vars/outputWidgets.d.ts +33 -0
- package/dist/vars/presets.d.cts +9 -0
- package/dist/vars/presets.d.ts +9 -0
- package/dist/vars/promptSyntax.d.cts +98 -0
- package/dist/vars/promptSyntax.d.ts +98 -0
- package/dist/web.d.cts +2 -0
- package/dist/web.d.ts +2 -19160
- package/dist/web.js +8040 -8292
- package/dist/web.js.map +119 -1
- package/examples/depth-explorer/web/tsconfig.json +1 -2
- package/examples/upscale-explorer/web/tsconfig.json +1 -2
- package/examples/web/tsconfig.json +1 -4
- package/examples/world-explorer/web/tsconfig.json +1 -2
- package/package.json +27 -32
- package/src/cli/serve/web/components/SideMenu.tsx +1 -1
- package/src/cli/serve/web/components/controls/LorasControl.tsx +2 -0
- package/src/cli/serve/web/components/controls/RichSelect.tsx +1 -0
- package/src/cli/serve/web/state/RunSt.poll.test.ts +2 -1
- package/src/cli/serve/web/tsconfig.json +1 -2
- package/src/cli/serve/web/widgets/RelightWidget.tsx +1 -0
- package/src/cli/tui/state/HostSt.ts +1 -1
- package/src/host/loraManagerApi.ts +8 -3
- package/src/runner/ComfyExecution.ts +3 -1
- package/src/runner/ComfyWsApi.ts +2 -1
- package/src/storage/ComfyStorage.ts +5 -4
- package/src/types/comfy-sdk.ts +1 -0
- package/src/utils/ansi.ts +1 -0
- package/dist/ServeApp-fsHtW5zG.js +0 -2689
- package/dist/ServeApp-fsHtW5zG.js.map +0 -1
- package/dist/exampleAssets-DZynSkZm.js +0 -6674
- package/dist/exampleAssets-DZynSkZm.js.map +0 -1
- package/dist/findDefinedWorkflow-qyqFea7q.js +0 -625
- package/dist/findDefinedWorkflow-qyqFea7q.js.map +0 -1
- package/dist/run-run-Cn2JzKlE.js +0 -449
- package/dist/run-run-Cn2JzKlE.js.map +0 -1
- package/dist/run-serve-BhGegaCI.js +0 -464
- package/dist/run-serve-BhGegaCI.js.map +0 -1
- package/dist/run-tui-CrM4ijkH.js +0 -4569
- package/dist/run-tui-CrM4ijkH.js.map +0 -1
- package/dist/schemaDrift-BGYJZGMD.js +0 -2225
- package/dist/schemaDrift-BGYJZGMD.js.map +0 -1
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
import { type LoraRecord, type LorasInput, type PromptInput } from './lanes.cjs';
|
|
2
|
+
import { type VarPreset, type VarPresetSpec } from './presets.cjs';
|
|
3
|
+
import { type MediaKind } from '../runner/mediaKinds.cjs';
|
|
4
|
+
import type { ComfyWorkflow } from '../runner/ComfyWorkflow.cjs';
|
|
5
|
+
import type { NodeOf } from '../types/comfy-sdk.cjs';
|
|
6
|
+
/**
|
|
7
|
+
* the var's CLASS, and the only safe way to discriminate one: `instanceof` compares class
|
|
8
|
+
* OBJECTS, and the published package hands the same class out twice — a consumer's
|
|
9
|
+
* `.cflow.ts` imports `comfy-ts` (dist/index.js) while `comfy-ts serve`/`tui` run from the
|
|
10
|
+
* cli bundle, so every `instanceof XVar` across that boundary is false (observed
|
|
11
|
+
* in a consumer app: "var 'prompt' has unsupported kind 'text'", for EVERY kind). A string tag
|
|
12
|
+
* crosses bundles; a class identity does not.
|
|
13
|
+
*/
|
|
14
|
+
export type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' | MediaKind;
|
|
15
|
+
/**
|
|
16
|
+
* full base: T is what's STORED/edited, Out what the GRAPH consumes at build
|
|
17
|
+
* time. They usually coincide — extend `ComfyVar<T>` for that. PromptVar is
|
|
18
|
+
* the one Out-specialized var (string in, PromptValue out); the split keeps
|
|
19
|
+
* outValue() cast-free.
|
|
20
|
+
*/
|
|
21
|
+
/** how a var LOOKS in the panel, set by the workflow: `v.int(8).ui({ icon, color, description })`.
|
|
22
|
+
* Every slot is optional, a color is any css color */
|
|
23
|
+
/** how one option of a choice var looks in the panel. Every field is optional: a bare option
|
|
24
|
+
* shows its value */
|
|
25
|
+
export type ChoiceOptionLook = {
|
|
26
|
+
/** a 24×24 svg path drawn in the color, or a whole `<svg …>` string */
|
|
27
|
+
icon?: string;
|
|
28
|
+
color?: string;
|
|
29
|
+
/** the name shown instead of the raw value (the value stays the payload) */
|
|
30
|
+
label?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
/** a picture: an http(s) url, or a local path relative to the workflow file */
|
|
33
|
+
thumb?: string;
|
|
34
|
+
/** when it came out: `2025`, `2025-11` */
|
|
35
|
+
date?: string;
|
|
36
|
+
/** what it weighs on disk: `1.3 GB` */
|
|
37
|
+
size?: string;
|
|
38
|
+
/** 1 (rough) to 5 (the best of its kind) */
|
|
39
|
+
quality?: number;
|
|
40
|
+
/** how long it takes: `0.9 s`, `30 s` */
|
|
41
|
+
speed?: string;
|
|
42
|
+
tags?: string[];
|
|
43
|
+
};
|
|
44
|
+
export type VarUi = {
|
|
45
|
+
/** shown as a (?) after the label, the text is its tooltip */
|
|
46
|
+
description?: string;
|
|
47
|
+
/** a 24×24 svg path drawn in the icon color, or a whole `<svg …>` string */
|
|
48
|
+
icon?: string;
|
|
49
|
+
/** the icon's color */
|
|
50
|
+
color?: string;
|
|
51
|
+
labelColor?: string;
|
|
52
|
+
/** the whole row, drawn without moving anything in it */
|
|
53
|
+
background?: string;
|
|
54
|
+
/** vars that go together: consecutive vars with the same group share one tinted block */
|
|
55
|
+
group?: string;
|
|
56
|
+
/** the block's tint, read from the first var of the group that sets it */
|
|
57
|
+
groupColor?: string;
|
|
58
|
+
border?: string;
|
|
59
|
+
/** choice vars: a look per option, keyed by the option value. The lit option is filled
|
|
60
|
+
* with its own color; a dropdown row shows the rest (ChoiceOptionLook) */
|
|
61
|
+
options?: Record<string, ChoiceOptionLook>;
|
|
62
|
+
/** the field is shown but disabled unless every named var holds one of the listed values:
|
|
63
|
+
* `{ model: ['aesthetic', 'base'] }`. Checked against the var names when the workflow loads.
|
|
64
|
+
* Display only: a disabled var's value still reaches the build */
|
|
65
|
+
activeWhen?: Record<string, readonly (string | number | boolean)[]>;
|
|
66
|
+
};
|
|
67
|
+
export declare abstract class ComfyVarBase<T, Out> {
|
|
68
|
+
readonly defaultValue: T;
|
|
69
|
+
label?: string | undefined;
|
|
70
|
+
abstract readonly kind: VarKind;
|
|
71
|
+
/** the vars-spec key, stamped by DefinedWorkflow at define time — error messages name the var with it */
|
|
72
|
+
name?: string;
|
|
73
|
+
/** panel looks, see VarUi. Never part of the value, never in a draft */
|
|
74
|
+
uiOpts: VarUi;
|
|
75
|
+
value: T;
|
|
76
|
+
constructor(defaultValue: T, label?: string | undefined);
|
|
77
|
+
set(value: T): this;
|
|
78
|
+
/** chainable: `v.choice([...], 'a').ui({ icon: 'M4 12h16', color: '#e0af68' })` */
|
|
79
|
+
ui(p: VarUi): this;
|
|
80
|
+
/** what drafts persist for this var (subclasses may add fields, e.g. seed mode) */
|
|
81
|
+
toJSON(): unknown;
|
|
82
|
+
/** what the GRAPH consumes at build time (varValues maps these return types) */
|
|
83
|
+
abstract outValue(): Out;
|
|
84
|
+
/**
|
|
85
|
+
* restore a value produced by toJSON() (drafts). The cast is sanctioned:
|
|
86
|
+
* drafts are our own round-trip, subclasses re-validate via set().
|
|
87
|
+
*/
|
|
88
|
+
loadJSON(value: unknown): this;
|
|
89
|
+
reset(): this;
|
|
90
|
+
/** parse a raw string (TUI text input) into this var's value; returns false when invalid */
|
|
91
|
+
abstract parse(raw: string): boolean;
|
|
92
|
+
/** how the value renders in a var list */
|
|
93
|
+
display(): string;
|
|
94
|
+
/** the string the inline editor starts from (round-trips through parse) */
|
|
95
|
+
toEditBuffer(): string;
|
|
96
|
+
/** hook run after every DefinedWorkflow.run() (default no-op; SeedVar advances) */
|
|
97
|
+
afterRun(): void;
|
|
98
|
+
}
|
|
99
|
+
/** the standard var: the graph consumes the stored value AS-IS (Out = T) */
|
|
100
|
+
export declare abstract class ComfyVar<T> extends ComfyVarBase<T, T> {
|
|
101
|
+
outValue(): T;
|
|
102
|
+
}
|
|
103
|
+
export type TextVarOpts = {
|
|
104
|
+
label?: string;
|
|
105
|
+
/** render as a box you can write paragraphs in, not a one-line field. Some text IS long by
|
|
106
|
+
* nature (an llm instruction, a system prompt) and a single line hides all but its start */
|
|
107
|
+
multiline?: boolean;
|
|
108
|
+
/** named starting texts, `{ label: text }`. The TUI and the web panel offer them behind one
|
|
109
|
+
* button and picking one REPLACES the value, so a preset is a shortcut, never a mode */
|
|
110
|
+
presets?: VarPresetSpec;
|
|
111
|
+
};
|
|
112
|
+
export declare class TextVar extends ComfyVar<string> {
|
|
113
|
+
readonly kind: 'text';
|
|
114
|
+
/** normalized `opts.presets`, in authored order */
|
|
115
|
+
readonly presets: VarPreset[];
|
|
116
|
+
readonly opts: TextVarOpts;
|
|
117
|
+
/** a bare label string was the whole second parameter before opts existed: a published
|
|
118
|
+
* consumer passing one must keep working, exactly as SeedVar does */
|
|
119
|
+
constructor(defaultValue: string, opts?: string | TextVarOpts);
|
|
120
|
+
parse(raw: string): boolean;
|
|
121
|
+
}
|
|
122
|
+
/** what PromptVar needs from a loras var: covariant face, so LorasVar<'a'|'b'> fits.
|
|
123
|
+
* `hostId` scopes the keyword lookup: the same file name on two hosts is often a
|
|
124
|
+
* different model, and injecting the other host's trigger words is a silently
|
|
125
|
+
* wrong generation. */
|
|
126
|
+
export type ActiveLoraSource = {
|
|
127
|
+
activeNames(): string[];
|
|
128
|
+
hostId?: string;
|
|
129
|
+
/** the parts of a lora's keyword left out of the prompt (LorasVar: the `mute` list) */
|
|
130
|
+
mutedWords?(name: string): string[];
|
|
131
|
+
};
|
|
132
|
+
/** where a prompt's tag completion comes from (the serve web editor). The list is never shipped:
|
|
133
|
+
* `url` is a local path (relative to the workflow file, `~/`, `file://`) or an http(s) url */
|
|
134
|
+
export type PromptTagsOpts = {
|
|
135
|
+
url: string;
|
|
136
|
+
/** insert `long_hair` as written in the list; default inserts `long hair` */
|
|
137
|
+
underscores?: boolean;
|
|
138
|
+
/** put in front of an artist tag on insert (Anima: `@`) */
|
|
139
|
+
artistPrefix?: string;
|
|
140
|
+
};
|
|
141
|
+
export type PromptVarOpts = {
|
|
142
|
+
label?: string;
|
|
143
|
+
loraKeywordsFrom?: ActiveLoraSource;
|
|
144
|
+
presets?: VarPresetSpec;
|
|
145
|
+
/** booru tag completion for this prompt: a tag list url, or the url with its insert rules */
|
|
146
|
+
tags?: string | PromptTagsOpts;
|
|
147
|
+
/** false when the model's encoder ignores `(text:1.2)`: the editor then flags every weight */
|
|
148
|
+
weights?: boolean;
|
|
149
|
+
};
|
|
150
|
+
/** what a prompt CONTRIBUTES to build: `vars.prompt.positive` / `.negative` */
|
|
151
|
+
export type PromptValue = {
|
|
152
|
+
positive: string;
|
|
153
|
+
negative: string;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* prompt text with editor comforts, all resolved at BUILD time (the editor and
|
|
157
|
+
* drafts keep the raw text):
|
|
158
|
+
* - `//` starts a COMMENT to the end of the line (src/vars/promptSyntax.ts) — stripped
|
|
159
|
+
* - `- ` lines are NEGATIVE prompt lines — removed from `.positive`,
|
|
160
|
+
* comma-joined into `.negative`
|
|
161
|
+
* - with `loraKeywordsFrom`, the ACTIVE loras' hand-assigned keywords
|
|
162
|
+
* (src/vars/loraKeywords.ts, ⌃K in the TUI) prefix `.positive` —
|
|
163
|
+
* `injectedKeywords()` is public so the TUI can PREVIEW the injection.
|
|
164
|
+
*/
|
|
165
|
+
export declare class PromptVar extends ComfyVarBase<PromptInput, PromptValue> {
|
|
166
|
+
promptOpts: PromptVarOpts;
|
|
167
|
+
readonly kind: 'prompt';
|
|
168
|
+
/** normalized `promptOpts.presets`, in authored order (TextVarOpts.presets owns the WHY) */
|
|
169
|
+
readonly presets: VarPreset[];
|
|
170
|
+
constructor(defaultValue: PromptInput, promptOpts?: PromptVarOpts);
|
|
171
|
+
/** in lanes mode the text carries `# name` headers, so a lane survives a round trip */
|
|
172
|
+
parse(raw: string): boolean;
|
|
173
|
+
toEditBuffer(): string;
|
|
174
|
+
/** a var list shows the lanes by name, the inactive ones in parentheses */
|
|
175
|
+
display(): string;
|
|
176
|
+
/** the text the build reads: the plain string, or the active lanes joined in order */
|
|
177
|
+
get text(): string;
|
|
178
|
+
/** the tag list options in their one object form, null when this prompt has no completion */
|
|
179
|
+
get tags(): PromptTagsOpts | null;
|
|
180
|
+
static isCommentLine(line: string): boolean;
|
|
181
|
+
static isNegativeLine(line: string): boolean;
|
|
182
|
+
/** the keyword prefix the flag will inject (deduped, lora-list order) — the TUI previews this */
|
|
183
|
+
injectedKeywords(): string[];
|
|
184
|
+
outValue(): PromptValue;
|
|
185
|
+
}
|
|
186
|
+
export declare class IntVar extends ComfyVar<number> {
|
|
187
|
+
opts: {
|
|
188
|
+
min?: number;
|
|
189
|
+
max?: number;
|
|
190
|
+
label?: string;
|
|
191
|
+
};
|
|
192
|
+
readonly kind: 'int';
|
|
193
|
+
constructor(defaultValue: number, opts?: {
|
|
194
|
+
min?: number;
|
|
195
|
+
max?: number;
|
|
196
|
+
label?: string;
|
|
197
|
+
});
|
|
198
|
+
set(value: number): this;
|
|
199
|
+
parse(raw: string): boolean;
|
|
200
|
+
}
|
|
201
|
+
export declare class FloatVar extends ComfyVar<number> {
|
|
202
|
+
opts: {
|
|
203
|
+
min?: number;
|
|
204
|
+
max?: number;
|
|
205
|
+
label?: string;
|
|
206
|
+
};
|
|
207
|
+
readonly kind: 'float';
|
|
208
|
+
constructor(defaultValue: number, opts?: {
|
|
209
|
+
min?: number;
|
|
210
|
+
max?: number;
|
|
211
|
+
label?: string;
|
|
212
|
+
});
|
|
213
|
+
set(value: number): this;
|
|
214
|
+
parse(raw: string): boolean;
|
|
215
|
+
}
|
|
216
|
+
/** '=' fixed · '+' increment each run · '-' decrement each run · '?' reroll each run */
|
|
217
|
+
export type SeedMode = '=' | '+' | '-' | '?';
|
|
218
|
+
/**
|
|
219
|
+
* a seed is a MODE + a number. `value` stays a plain number (what the graph
|
|
220
|
+
* consumes); `mode` decides how it advances after each run (afterRun()):
|
|
221
|
+
* `= 12` fixed · `+ 0` auto-increment · `- 0` auto-decrement · `? 0` random.
|
|
222
|
+
* The number shown is always the seed the NEXT run will use.
|
|
223
|
+
*/
|
|
224
|
+
export declare class SeedVar extends ComfyVar<number> {
|
|
225
|
+
readonly kind: 'seed';
|
|
226
|
+
mode: SeedMode;
|
|
227
|
+
/** the mode a reset() restores — the SPEC default, never the live one (introspection
|
|
228
|
+
* reads this: a running mode must not masquerade as the var's default) */
|
|
229
|
+
readonly defaultMode: SeedMode;
|
|
230
|
+
/** `opts` is the modern shape; a bare label string stays accepted, since that was the
|
|
231
|
+
* signature before a workflow could declare the mode it wants to run in */
|
|
232
|
+
constructor(defaultValue?: number, opts?: string | {
|
|
233
|
+
label?: string;
|
|
234
|
+
mode?: SeedMode;
|
|
235
|
+
});
|
|
236
|
+
setMode(mode: SeedMode): this;
|
|
237
|
+
randomize(): this;
|
|
238
|
+
set(value: number): this;
|
|
239
|
+
/** move the seed to what the NEXT run should use, per mode */
|
|
240
|
+
advance(): this;
|
|
241
|
+
afterRun(): void;
|
|
242
|
+
/** mode is part of the seed's state: a reset must not keep a caller's `?`/`+` alive
|
|
243
|
+
* ('=' is the construction default; drafts restore their own mode via loadJSON) */
|
|
244
|
+
reset(): this;
|
|
245
|
+
/** parse `+` `- 12` `= 5` `?` or a bare number (=> fixed). Keeps the current number when none given */
|
|
246
|
+
parse(raw: string): boolean;
|
|
247
|
+
display(): string;
|
|
248
|
+
toEditBuffer(): string;
|
|
249
|
+
toJSON(): unknown;
|
|
250
|
+
loadJSON(value: unknown): this;
|
|
251
|
+
}
|
|
252
|
+
export declare class ToggleVar extends ComfyVar<boolean> {
|
|
253
|
+
readonly kind: 'toggle';
|
|
254
|
+
toggle(): this;
|
|
255
|
+
parse(raw: string): boolean;
|
|
256
|
+
display(): string;
|
|
257
|
+
}
|
|
258
|
+
/** how many options a choice holds: exactly one (the default), one or none, or any number */
|
|
259
|
+
export type ChoiceSelect = 'one' | 'zero-or-one' | 'many';
|
|
260
|
+
/** where a host-bound choice reads its options: one loader input of the host's live schema,
|
|
261
|
+
* optionally narrowed (`v.model`) */
|
|
262
|
+
export type HostSlotSource = {
|
|
263
|
+
slot: string;
|
|
264
|
+
filter?: RegExp;
|
|
265
|
+
};
|
|
266
|
+
export declare class ChoiceVar<T extends string> extends ComfyVar<T> {
|
|
267
|
+
readonly kind: 'choice';
|
|
268
|
+
readonly select: 'one';
|
|
269
|
+
private list;
|
|
270
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T, label?: string);
|
|
271
|
+
get choices(): readonly T[];
|
|
272
|
+
/** set for `v.model`: the loader input this choice lists */
|
|
273
|
+
get hostSlot(): HostSlotSource | null;
|
|
274
|
+
bindHost(host: LorasHost): void;
|
|
275
|
+
next(delta?: number): this;
|
|
276
|
+
parse(raw: string): boolean;
|
|
277
|
+
}
|
|
278
|
+
/** one option or none: `null` is "nothing picked", clicking the lit option clears it */
|
|
279
|
+
export declare class OptionalChoiceVar<T extends string> extends ComfyVar<T | null> {
|
|
280
|
+
readonly kind: 'choice';
|
|
281
|
+
readonly select: 'zero-or-one';
|
|
282
|
+
private list;
|
|
283
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T | null, label?: string);
|
|
284
|
+
get choices(): readonly T[];
|
|
285
|
+
get hostSlot(): HostSlotSource | null;
|
|
286
|
+
bindHost(host: LorasHost): void;
|
|
287
|
+
/** pick `c`, or clear it when it is already the one picked */
|
|
288
|
+
toggle(c: T): this;
|
|
289
|
+
/** the TUI text form: a choice, or an empty line for none */
|
|
290
|
+
parse(raw: string): boolean;
|
|
291
|
+
toEditBuffer(): string;
|
|
292
|
+
/** a draft from when this was a many choice holds a list: its first known option */
|
|
293
|
+
loadJSON(value: unknown): this;
|
|
294
|
+
display(): string;
|
|
295
|
+
}
|
|
296
|
+
/** any number of options, kept in the order the choices list them */
|
|
297
|
+
export declare class MultiChoiceVar<T extends string> extends ComfyVar<T[]> {
|
|
298
|
+
readonly choices: readonly T[];
|
|
299
|
+
readonly kind: 'choice';
|
|
300
|
+
readonly select: 'many';
|
|
301
|
+
constructor(choices: readonly T[], defaultValue: readonly T[], label?: string);
|
|
302
|
+
toggle(c: T): this;
|
|
303
|
+
/** the TUI text form: `a, b` */
|
|
304
|
+
parse(raw: string): boolean;
|
|
305
|
+
toEditBuffer(): string;
|
|
306
|
+
/** a draft from when this was a single choice holds one value: a list of one. Unknown
|
|
307
|
+
* options are dropped, the list comes back in the choices order */
|
|
308
|
+
loadJSON(value: unknown): this;
|
|
309
|
+
display(): string;
|
|
310
|
+
}
|
|
311
|
+
/** the three choice shapes, told apart by `select` */
|
|
312
|
+
export type AnyChoiceVar<T extends string = string> = ChoiceVar<T> | OptionalChoiceVar<T> | MultiChoiceVar<T>;
|
|
313
|
+
type ChoiceOpts<S extends ChoiceSelect> = {
|
|
314
|
+
label?: string;
|
|
315
|
+
select: S;
|
|
316
|
+
};
|
|
317
|
+
declare function choice<const T extends string>(choices: readonly T[], defaultValue: T, label?: string | {
|
|
318
|
+
label?: string;
|
|
319
|
+
select?: 'one';
|
|
320
|
+
}): ChoiceVar<T>;
|
|
321
|
+
declare function choice<const T extends string>(choices: readonly T[], defaultValue: T | null, opts: ChoiceOpts<'zero-or-one'>): OptionalChoiceVar<T>;
|
|
322
|
+
declare function choice<const T extends string>(choices: readonly T[], defaultValue: readonly T[], opts: ChoiceOpts<'many'>): MultiChoiceVar<T>;
|
|
323
|
+
export type ModelVarOpts<T extends string> = {
|
|
324
|
+
/** narrows the host's list: `/krea/i` */
|
|
325
|
+
filter?: RegExp;
|
|
326
|
+
label?: string;
|
|
327
|
+
/** a file name, or null for "the workflow decides" (the build then reads null) */
|
|
328
|
+
default: T | null;
|
|
329
|
+
};
|
|
330
|
+
/** a choice over the host's LIVE file list for one loader input (`'UNETLoader.unet_name'`),
|
|
331
|
+
* resolved at define time and rebound by serve's refresh-schema: a downloaded model is picked
|
|
332
|
+
* in the draft, never written into the workflow file */
|
|
333
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
334
|
+
default: T;
|
|
335
|
+
}): ChoiceVar<T>;
|
|
336
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
337
|
+
default: null;
|
|
338
|
+
}): OptionalChoiceVar<T>;
|
|
339
|
+
/** per-lora setting, every spelling documented in src/vars/loraEntry.ts */
|
|
340
|
+
export type { LoraStrength } from './loraEntry.cjs';
|
|
341
|
+
export type ActiveLora<T extends string> = {
|
|
342
|
+
lora_name: T;
|
|
343
|
+
strength_model: number;
|
|
344
|
+
strength_clip: number;
|
|
345
|
+
};
|
|
346
|
+
/** normalize a loras record into what a standard LoraLoader chain consumes */
|
|
347
|
+
export declare function activeLoras<T extends string>(loras: LorasInput<T>): ActiveLora<T>[];
|
|
348
|
+
/** what LorasVar.bindHost needs — structural, so ComfyVars never imports ComfyHost */
|
|
349
|
+
export type LorasHost = {
|
|
350
|
+
data?: {
|
|
351
|
+
id?: string;
|
|
352
|
+
};
|
|
353
|
+
schema: {
|
|
354
|
+
getLoras(filter?: RegExp): string[];
|
|
355
|
+
stringValues(slot: string): string[];
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* multi-select lora stack over a DYNAMIC options list — a RegExp resolves
|
|
360
|
+
* against the host's loras at define time (DefinedWorkflow calls bindHost),
|
|
361
|
+
* or feed it host discovery (`host.schema.getLoras(regex?)`) directly; never
|
|
362
|
+
* a hardcoded inventory. Selection is empty by default.
|
|
363
|
+
*/
|
|
364
|
+
/**
|
|
365
|
+
* the value is EITHER a plain record OR `{ lanes: [...] }` (src/vars/lanes.ts): named groups the
|
|
366
|
+
* build merges in listed order, skipping inactive ones. Every method reads the merged record and
|
|
367
|
+
* writes into the lane that holds the lora, so the TUI never needs to know lanes exist
|
|
368
|
+
*/
|
|
369
|
+
export declare class LorasVar<T extends string> extends ComfyVarBase<LorasInput<T>, LoraRecord<T>> {
|
|
370
|
+
private readonly optionsSource;
|
|
371
|
+
readonly kind: 'loras';
|
|
372
|
+
/** last non-false strength per lora, so untick → re-tick restores it */
|
|
373
|
+
private prev;
|
|
374
|
+
/** a RegExp source resolves lazily (bindHost) — null until then */
|
|
375
|
+
private resolvedOptions;
|
|
376
|
+
/** which host these loras live on, so their metadata is read from ITS mirror */
|
|
377
|
+
hostId: string | undefined;
|
|
378
|
+
constructor(optionsSource: readonly T[] | RegExp, initial?: LorasInput<T>, label?: string);
|
|
379
|
+
/** the filter the workflow declared, when it declared one (`v.loras(/krea-?2/i)`). Public so
|
|
380
|
+
* a UI can SHOW it, and so serve applies the same narrowing to loras only its lora-manager
|
|
381
|
+
* mirror knows, an unfiltered union would put the whole catalog back in a filtered picker */
|
|
382
|
+
get optionsFilter(): RegExp | null;
|
|
383
|
+
get options(): readonly T[];
|
|
384
|
+
/** DefinedWorkflow binds the host at define time: a RegExp source resolves here.
|
|
385
|
+
* cast: whitelist family 1 (agent/coding.md) — getLoras() returns the runtime
|
|
386
|
+
* values of the SAME object_info enum the generated E_LoraName union comes from */
|
|
387
|
+
bindHost(host: LorasHost): void;
|
|
388
|
+
get names(): T[];
|
|
389
|
+
/** the loras the build reads: the plain record, or the active lanes merged in order */
|
|
390
|
+
get record(): LoraRecord<T>;
|
|
391
|
+
/** what the graph consumes. A lora in two active lanes runs once, with its FIRST setting */
|
|
392
|
+
outValue(): LoraRecord<T>;
|
|
393
|
+
/** rewrite one lora wherever it lives: the plain record, or the lane that holds it */
|
|
394
|
+
private write;
|
|
395
|
+
/** the parts of this lora's prompt keyword left out of the prompt */
|
|
396
|
+
mutedWords(name: string): string[];
|
|
397
|
+
/** loras currently ON (PromptVar keyword prefixing consumes this) */
|
|
398
|
+
activeNames(): T[];
|
|
399
|
+
isOn(name: T): boolean;
|
|
400
|
+
toggleItem(name: T): this;
|
|
401
|
+
/** step both strengths by delta (true becomes 1 first); no-op when off */
|
|
402
|
+
adjustItem(name: T, delta: number): this;
|
|
403
|
+
/** compact per-item strength label for lists */
|
|
404
|
+
strengthLabel(name: T): string;
|
|
405
|
+
parse(raw: string): boolean;
|
|
406
|
+
/** short human name: subfolder + extension stripped */
|
|
407
|
+
static shortName(name: string): string;
|
|
408
|
+
/** tick (true) or untick (false) every lora in `names` (default: all options) */
|
|
409
|
+
setAll(on: boolean, names?: readonly T[]): this;
|
|
410
|
+
display(): string;
|
|
411
|
+
}
|
|
412
|
+
export type SizeValue = {
|
|
413
|
+
width: number;
|
|
414
|
+
height: number;
|
|
415
|
+
};
|
|
416
|
+
export type SizePreset = {
|
|
417
|
+
label: string;
|
|
418
|
+
width: number;
|
|
419
|
+
height: number;
|
|
420
|
+
};
|
|
421
|
+
/** SDXL-style ~1MP buckets, multiples of 64 — safe for most latent models */
|
|
422
|
+
export declare const DEFAULT_SIZE_PRESETS: SizePreset[];
|
|
423
|
+
/** the same aspect ratios around 512, for SD1.5-era models trained at ~0.25MP */
|
|
424
|
+
export declare const SD15_SIZE_PRESETS: SizePreset[];
|
|
425
|
+
/** starred presets are one click away in the panel, before the full list */
|
|
426
|
+
export declare const DEFAULT_STARRED_SIZES: string[];
|
|
427
|
+
/** the family that matches a workflow's own default: a 512×512 workflow is an SD1.5-era one,
|
|
428
|
+
* and offering it 1024 buckets would be offering sizes it was never trained at */
|
|
429
|
+
export declare function sizePresetsFor(defaultValue: SizeValue | undefined): SizePreset[];
|
|
430
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
431
|
+
* size of a linked image var (the widget shows
|
|
432
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
433
|
+
export declare class SizeVar extends ComfyVar<SizeValue> {
|
|
434
|
+
readonly presets: SizePreset[];
|
|
435
|
+
readonly imageVar?: ImageVar | undefined;
|
|
436
|
+
/** preset LABELS starred by default; a user's own stars live in the panel */
|
|
437
|
+
readonly starred: readonly string[];
|
|
438
|
+
readonly kind: 'size';
|
|
439
|
+
constructor(defaultValue?: SizeValue, presets?: SizePreset[], label?: string, imageVar?: ImageVar | undefined,
|
|
440
|
+
/** preset LABELS starred by default; a user's own stars live in the panel */
|
|
441
|
+
starred?: readonly string[]);
|
|
442
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
443
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
444
|
+
* image var itself, the size row simply disappears) */
|
|
445
|
+
imageSize(): {
|
|
446
|
+
width: number;
|
|
447
|
+
height: number;
|
|
448
|
+
name: string;
|
|
449
|
+
} | null;
|
|
450
|
+
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
451
|
+
parse(raw: string): boolean;
|
|
452
|
+
display(): string;
|
|
453
|
+
}
|
|
454
|
+
export type MediaVarOpts = {
|
|
455
|
+
/** where the TUI picker starts browsing AND what relative values resolve against (absPath) */
|
|
456
|
+
folder?: string;
|
|
457
|
+
/** picker listing filter, lowercase without dots; never affects the value. NOT a security
|
|
458
|
+
* boundary: `comfy-ts serve` keeps its own floor of media types it will read off the disk
|
|
459
|
+
* and upload, which this list may NARROW but never widen (emptying it changes the picker,
|
|
460
|
+
* not what the api accepts) */
|
|
461
|
+
extensions?: readonly string[];
|
|
462
|
+
label?: string;
|
|
463
|
+
/** the text var a file's `<name>.txt` sidecar fills, when a driver sets this var from a file
|
|
464
|
+
* and leaves that one unset: a voice clip's transcript (`comfy-ts run`) */
|
|
465
|
+
sidecarText?: TextVar;
|
|
466
|
+
/** one-click starting files: `{ 'a lioness': exampleImagePath(…), 'a ruin': 'https://…' }`.
|
|
467
|
+
* A local path that is not on this machine is shown disabled, a url is fetched when a run
|
|
468
|
+
* uses it. Key order is display order */
|
|
469
|
+
presets?: Record<string, string>;
|
|
470
|
+
};
|
|
471
|
+
export type ImageVarOpts = MediaVarOpts;
|
|
472
|
+
export type AudioVarOpts = MediaVarOpts;
|
|
473
|
+
export type VideoVarOpts = MediaVarOpts;
|
|
474
|
+
export declare const DEFAULT_IMAGE_EXTENSIONS: readonly string[];
|
|
475
|
+
export declare const DEFAULT_AUDIO_EXTENSIONS: readonly string[];
|
|
476
|
+
export declare const DEFAULT_VIDEO_EXTENSIONS: readonly string[];
|
|
477
|
+
/** empty media var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
478
|
+
export declare class MediaVarEmptyError extends Error {
|
|
479
|
+
readonly varName: string;
|
|
480
|
+
readonly media: MediaKind;
|
|
481
|
+
/** name, not instanceof: the cli bundle and dist/index.js each define this class */
|
|
482
|
+
readonly name: string;
|
|
483
|
+
constructor(varName: string, media?: MediaKind);
|
|
484
|
+
}
|
|
485
|
+
/** the image-only name this error had first; the same class */
|
|
486
|
+
export declare const ImageVarEmptyError: typeof MediaVarEmptyError;
|
|
487
|
+
export type ImageVarEmptyError = MediaVarEmptyError;
|
|
488
|
+
/**
|
|
489
|
+
* a local media file path. The VALUE is a PLAIN PATH STRING — text-encodable,
|
|
490
|
+
* drafts persist it verbatim (toJSON = the string), hand-editable in the
|
|
491
|
+
* draft json. Empty = unset: outValue()/absPath() throw MediaVarEmptyError,
|
|
492
|
+
* so a build never runs on a silent placeholder. The TUI opens the file
|
|
493
|
+
* picker overlay for every media kind.
|
|
494
|
+
*/
|
|
495
|
+
export declare abstract class MediaVar extends ComfyVar<string> {
|
|
496
|
+
opts: MediaVarOpts;
|
|
497
|
+
abstract readonly kind: MediaKind;
|
|
498
|
+
constructor(defaultValue: string, opts?: MediaVarOpts);
|
|
499
|
+
/** what the picker lists (lowercase, no dots) */
|
|
500
|
+
get extensions(): readonly string[];
|
|
501
|
+
/** the one-click starting files, `~/` expanded, in their declared order */
|
|
502
|
+
get presets(): {
|
|
503
|
+
label: string;
|
|
504
|
+
value: string;
|
|
505
|
+
}[];
|
|
506
|
+
set(value: string): this;
|
|
507
|
+
parse(raw: string): boolean;
|
|
508
|
+
isSet(): boolean;
|
|
509
|
+
private emptyError;
|
|
510
|
+
/** the ONE resolution helper: absolute kept as-is, relative resolved against opts.folder, else cwd */
|
|
511
|
+
absPath(): string;
|
|
512
|
+
/** empty = unset: the build fails LOUD here (varValues calls outValue) */
|
|
513
|
+
outValue(): string;
|
|
514
|
+
display(): string;
|
|
515
|
+
/** upload the file hash-named (reruns dedupe) and add this medium's loader node. A dry
|
|
516
|
+
* build names the file by its hash and uploads nothing */
|
|
517
|
+
protected loadVia(wf: ComfyWorkflow<string>): Promise<unknown>;
|
|
518
|
+
}
|
|
519
|
+
/** a local image path, loaded through LoadImage */
|
|
520
|
+
export declare class ImageVar extends MediaVar {
|
|
521
|
+
readonly kind: 'image';
|
|
522
|
+
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadImage'>>;
|
|
523
|
+
}
|
|
524
|
+
/** a local audio path, loaded through LoadAudio */
|
|
525
|
+
export declare class AudioVar extends MediaVar {
|
|
526
|
+
readonly kind: 'audio';
|
|
527
|
+
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadAudio'>>;
|
|
528
|
+
}
|
|
529
|
+
/** a local video path, loaded through LoadVideo */
|
|
530
|
+
export declare class VideoVar extends MediaVar {
|
|
531
|
+
readonly kind: 'video';
|
|
532
|
+
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadVideo'>>;
|
|
533
|
+
}
|
|
534
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.model / v.loras / v.size / v.image / v.audio / v.video */
|
|
535
|
+
export declare const v: {
|
|
536
|
+
text: (defaultValue: string, opts?: TextVarOpts | string) => TextVar;
|
|
537
|
+
prompt: (
|
|
538
|
+
/** a string, or `{ lanes: [{ name, prompt, active }] }` merged in listed order */
|
|
539
|
+
defaultValue: PromptInput, opts?: PromptVarOpts) => PromptVar;
|
|
540
|
+
int: (defaultValue: number, opts?: {
|
|
541
|
+
min?: number;
|
|
542
|
+
max?: number;
|
|
543
|
+
label?: string;
|
|
544
|
+
}) => IntVar;
|
|
545
|
+
float: (defaultValue: number, opts?: {
|
|
546
|
+
min?: number;
|
|
547
|
+
max?: number;
|
|
548
|
+
label?: string;
|
|
549
|
+
}) => FloatVar;
|
|
550
|
+
/** `mode` is the SPEC default the workflow runs in: `'+'` makes every run step the seed,
|
|
551
|
+
* which is what a tuning session wants, and reset()/revert come back to it */
|
|
552
|
+
seed: (defaultValue?: number, opts?: string | {
|
|
553
|
+
label?: string;
|
|
554
|
+
mode?: SeedMode;
|
|
555
|
+
}) => SeedVar;
|
|
556
|
+
toggle: (defaultValue: boolean, label?: string) => ToggleVar;
|
|
557
|
+
/** exactly one option (the default), `{ select: 'zero-or-one' }` for one or none (value
|
|
558
|
+
* `T | null`), `{ select: 'many' }` for any number (value `T[]`) */
|
|
559
|
+
choice: typeof choice;
|
|
560
|
+
loras: <T extends string = string>(options: readonly T[] | RegExp,
|
|
561
|
+
/** a record, or `{ lanes: [{ name, active, loras }] }` merged in listed order */
|
|
562
|
+
initial?: LorasInput<T>, label?: string) => LorasVar<T>;
|
|
563
|
+
size: (defaultValue?: SizeValue, opts?: {
|
|
564
|
+
presets?: SizePreset[];
|
|
565
|
+
starred?: readonly string[];
|
|
566
|
+
label?: string;
|
|
567
|
+
image?: ImageVar;
|
|
568
|
+
}) => SizeVar;
|
|
569
|
+
/** host-bound: only inside defineWorkflow({ vars: (v) => … }), typed per slot there */
|
|
570
|
+
model: typeof model;
|
|
571
|
+
image: (defaultValue: string, opts?: MediaVarOpts) => ImageVar;
|
|
572
|
+
audio: (defaultValue: string, opts?: MediaVarOpts) => AudioVar;
|
|
573
|
+
video: (defaultValue: string, opts?: MediaVarOpts) => VideoVar;
|
|
574
|
+
};
|
|
575
|
+
/**
|
|
576
|
+
* structural face of any var: readonly `value` keeps ComfyVar<T> assignable
|
|
577
|
+
* despite T-invariance on the mutable field. VarValues re-derives the exact
|
|
578
|
+
* value types via infer.
|
|
579
|
+
*/
|
|
580
|
+
export type AnyVar = {
|
|
581
|
+
readonly kind: VarKind;
|
|
582
|
+
readonly value: unknown;
|
|
583
|
+
readonly defaultValue: unknown;
|
|
584
|
+
readonly label?: string;
|
|
585
|
+
/** the vars-spec key — DefinedWorkflow writes it at define time */
|
|
586
|
+
name?: string;
|
|
587
|
+
readonly uiOpts: VarUi;
|
|
588
|
+
parse(raw: string): boolean;
|
|
589
|
+
loadJSON(value: unknown): unknown;
|
|
590
|
+
reset(): unknown;
|
|
591
|
+
toJSON(): unknown;
|
|
592
|
+
outValue(): unknown;
|
|
593
|
+
display(): string;
|
|
594
|
+
toEditBuffer(): string;
|
|
595
|
+
afterRun(): void;
|
|
596
|
+
/** host-dependent vars (LorasVar regex) resolve here — DefinedWorkflow calls it at define time */
|
|
597
|
+
bindHost?(host: LorasHost): void;
|
|
598
|
+
};
|
|
599
|
+
export type VarsSpec = {
|
|
600
|
+
[key: string]: AnyVar;
|
|
601
|
+
};
|
|
602
|
+
export type VarValues<V extends VarsSpec> = {
|
|
603
|
+
[K in keyof V]: V[K] extends {
|
|
604
|
+
outValue(): infer O;
|
|
605
|
+
} ? O : never;
|
|
606
|
+
};
|
|
607
|
+
export declare function varValues<V extends VarsSpec>(vars: V): VarValues<V>;
|