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,17 @@
|
|
|
1
|
+
export interface SSHHostConfig {
|
|
2
|
+
host: string;
|
|
3
|
+
hostname: string;
|
|
4
|
+
user: string;
|
|
5
|
+
controlMaster?: string;
|
|
6
|
+
controlPath?: string;
|
|
7
|
+
controlPersist?: string;
|
|
8
|
+
identityFile?: string;
|
|
9
|
+
[key: string]: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare class SSHConfigManager {
|
|
12
|
+
private configPath;
|
|
13
|
+
constructor();
|
|
14
|
+
private parseConfig;
|
|
15
|
+
private formatHostConfig;
|
|
16
|
+
upsertSSHHostEntryInShhConfig(config: SSHHostConfig): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SSHHostConfig {
|
|
2
|
+
host: string;
|
|
3
|
+
hostname: string;
|
|
4
|
+
user: string;
|
|
5
|
+
controlMaster?: string;
|
|
6
|
+
controlPath?: string;
|
|
7
|
+
controlPersist?: string;
|
|
8
|
+
identityFile?: string;
|
|
9
|
+
[key: string]: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare class SSHConfigManager {
|
|
12
|
+
private configPath;
|
|
13
|
+
constructor();
|
|
14
|
+
private parseConfig;
|
|
15
|
+
private formatHostConfig;
|
|
16
|
+
upsertSSHHostEntryInShhConfig(config: SSHHostConfig): void;
|
|
17
|
+
}
|
package/dist/state.d.cts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ComfyHost, type ComfyHostData } from './host/ComfyHost.cjs';
|
|
2
|
+
import { ComfyRegistry } from './manager/ComfyRegistry.cjs';
|
|
3
|
+
import { type ComfyStorage } from './storage/ComfyStorage.cjs';
|
|
4
|
+
import { type AbsolutePath, type RelativePath } from './types/index.cjs';
|
|
5
|
+
/** the ONE settings-file location rule — run-tui reads it BEFORE any module
|
|
6
|
+
* import creates the comfyts global, so the path logic cannot live on the instance only */
|
|
7
|
+
export declare function settingsPathFor(root: string): AbsolutePath;
|
|
8
|
+
/** singleton */
|
|
9
|
+
export declare class ComfyTS {
|
|
10
|
+
version: string;
|
|
11
|
+
/** the storage seam (architecture item 13): node fs by default, in-memory on web */
|
|
12
|
+
storage: ComfyStorage;
|
|
13
|
+
constructor(p?: {
|
|
14
|
+
rootPath?: string;
|
|
15
|
+
storage?: ComfyStorage;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* multi-module entrypoint: returns the existing global instance or creates
|
|
19
|
+
* it. Workflow modules MUST use this (the TUI imports many of them into one
|
|
20
|
+
* process); `new ComfyTS()` still throws on a second instance.
|
|
21
|
+
*/
|
|
22
|
+
static create(p?: {
|
|
23
|
+
rootPath?: string;
|
|
24
|
+
storage?: ComfyStorage;
|
|
25
|
+
}): ComfyTS;
|
|
26
|
+
/** every host created through host(), keyed by id — one instance (and one ws) per id */
|
|
27
|
+
hosts: Map<string, ComfyHost>;
|
|
28
|
+
host<const ID extends string>(data: ComfyHostData & {
|
|
29
|
+
id: ID;
|
|
30
|
+
}): ComfyHost<ID>;
|
|
31
|
+
/** the host with the shortest queue, for `wf.run({ host: await comfy.leastBusy([a, b]) })` */
|
|
32
|
+
leastBusy<H extends ComfyHost<string>>(hosts: readonly H[], p?: {
|
|
33
|
+
timeoutMs?: number;
|
|
34
|
+
}): Promise<H>;
|
|
35
|
+
/**
|
|
36
|
+
* A ComfyRegistry instance that provides access to all
|
|
37
|
+
* known Comfy nodes, models, plugins, ...
|
|
38
|
+
* lazy: constructing it parses ~3MB of ComfyUI-Manager JSON, only pay when used
|
|
39
|
+
*/
|
|
40
|
+
private _registry;
|
|
41
|
+
get registry(): ComfyRegistry;
|
|
42
|
+
/** root path used to resolve things (set in the constructor, storage.cwd() default) */
|
|
43
|
+
rootPath: AbsolutePath;
|
|
44
|
+
/**
|
|
45
|
+
* every repo using comfy-ts gets ONE `.comfy-ts/` folder:
|
|
46
|
+
* .comfy-ts/hosts/<id>/{object_info.json, embeddings.json, sdk.d.ts}
|
|
47
|
+
* .comfy-ts/outputs/... generated images & workflows
|
|
48
|
+
* .comfy-ts/drafts/<workflow-id>/<draft>.json TUI var snapshots (local, gitignored)
|
|
49
|
+
* .comfy-ts/prompt-enhancers/<name>.md serve web ui master prompts (local, gitignored)
|
|
50
|
+
*/
|
|
51
|
+
baseFolder: AbsolutePath;
|
|
52
|
+
hostsFolder: AbsolutePath;
|
|
53
|
+
outputPath: AbsolutePath;
|
|
54
|
+
resolveFromDrafts(relativePath: string): AbsolutePath;
|
|
55
|
+
/** master prompts of the serve web ui's prompt enhancer — hand-editable markdown */
|
|
56
|
+
resolveFromPromptEnhancers(relativePath: string): AbsolutePath;
|
|
57
|
+
/** the serve web ui's LLM configs (prompt enhancer), one json per config */
|
|
58
|
+
resolveFromLlmConfigs(relativePath: string): AbsolutePath;
|
|
59
|
+
resolveFromCache(relativePath: string): AbsolutePath;
|
|
60
|
+
/** local TUI settings (preview mode, last draft per workflow) — gitignored */
|
|
61
|
+
get settingsPath(): AbsolutePath;
|
|
62
|
+
resolveFromHosts(relativePath: string): AbsolutePath;
|
|
63
|
+
/**
|
|
64
|
+
* Resolves a relative path against an absolute path.
|
|
65
|
+
* @param from - The absolute path to resolve from.
|
|
66
|
+
* @param relativePath - The relative path to resolve.
|
|
67
|
+
* @returns The resolved absolute path.
|
|
68
|
+
*/
|
|
69
|
+
resolve(from: AbsolutePath, relativePath: RelativePath): AbsolutePath;
|
|
70
|
+
resolveFromOutput(relativePath: string): AbsolutePath;
|
|
71
|
+
readJSON_: <T>(absPath: AbsolutePath, def?: T) => T;
|
|
72
|
+
autolayoutOpts: {
|
|
73
|
+
node_hsep: number;
|
|
74
|
+
node_vsep: number;
|
|
75
|
+
forceLeft: boolean;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
declare global {
|
|
79
|
+
var comfyts: ComfyTS;
|
|
80
|
+
}
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ComfyHost, type ComfyHostData } from './host/ComfyHost.js';
|
|
2
|
+
import { ComfyRegistry } from './manager/ComfyRegistry.js';
|
|
3
|
+
import { type ComfyStorage } from './storage/ComfyStorage.js';
|
|
4
|
+
import { type AbsolutePath, type RelativePath } from './types/index.js';
|
|
5
|
+
/** the ONE settings-file location rule — run-tui reads it BEFORE any module
|
|
6
|
+
* import creates the comfyts global, so the path logic cannot live on the instance only */
|
|
7
|
+
export declare function settingsPathFor(root: string): AbsolutePath;
|
|
8
|
+
/** singleton */
|
|
9
|
+
export declare class ComfyTS {
|
|
10
|
+
version: string;
|
|
11
|
+
/** the storage seam (architecture item 13): node fs by default, in-memory on web */
|
|
12
|
+
storage: ComfyStorage;
|
|
13
|
+
constructor(p?: {
|
|
14
|
+
rootPath?: string;
|
|
15
|
+
storage?: ComfyStorage;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* multi-module entrypoint: returns the existing global instance or creates
|
|
19
|
+
* it. Workflow modules MUST use this (the TUI imports many of them into one
|
|
20
|
+
* process); `new ComfyTS()` still throws on a second instance.
|
|
21
|
+
*/
|
|
22
|
+
static create(p?: {
|
|
23
|
+
rootPath?: string;
|
|
24
|
+
storage?: ComfyStorage;
|
|
25
|
+
}): ComfyTS;
|
|
26
|
+
/** every host created through host(), keyed by id — one instance (and one ws) per id */
|
|
27
|
+
hosts: Map<string, ComfyHost>;
|
|
28
|
+
host<const ID extends string>(data: ComfyHostData & {
|
|
29
|
+
id: ID;
|
|
30
|
+
}): ComfyHost<ID>;
|
|
31
|
+
/** the host with the shortest queue, for `wf.run({ host: await comfy.leastBusy([a, b]) })` */
|
|
32
|
+
leastBusy<H extends ComfyHost<string>>(hosts: readonly H[], p?: {
|
|
33
|
+
timeoutMs?: number;
|
|
34
|
+
}): Promise<H>;
|
|
35
|
+
/**
|
|
36
|
+
* A ComfyRegistry instance that provides access to all
|
|
37
|
+
* known Comfy nodes, models, plugins, ...
|
|
38
|
+
* lazy: constructing it parses ~3MB of ComfyUI-Manager JSON, only pay when used
|
|
39
|
+
*/
|
|
40
|
+
private _registry;
|
|
41
|
+
get registry(): ComfyRegistry;
|
|
42
|
+
/** root path used to resolve things (set in the constructor, storage.cwd() default) */
|
|
43
|
+
rootPath: AbsolutePath;
|
|
44
|
+
/**
|
|
45
|
+
* every repo using comfy-ts gets ONE `.comfy-ts/` folder:
|
|
46
|
+
* .comfy-ts/hosts/<id>/{object_info.json, embeddings.json, sdk.d.ts}
|
|
47
|
+
* .comfy-ts/outputs/... generated images & workflows
|
|
48
|
+
* .comfy-ts/drafts/<workflow-id>/<draft>.json TUI var snapshots (local, gitignored)
|
|
49
|
+
* .comfy-ts/prompt-enhancers/<name>.md serve web ui master prompts (local, gitignored)
|
|
50
|
+
*/
|
|
51
|
+
baseFolder: AbsolutePath;
|
|
52
|
+
hostsFolder: AbsolutePath;
|
|
53
|
+
outputPath: AbsolutePath;
|
|
54
|
+
resolveFromDrafts(relativePath: string): AbsolutePath;
|
|
55
|
+
/** master prompts of the serve web ui's prompt enhancer — hand-editable markdown */
|
|
56
|
+
resolveFromPromptEnhancers(relativePath: string): AbsolutePath;
|
|
57
|
+
/** the serve web ui's LLM configs (prompt enhancer), one json per config */
|
|
58
|
+
resolveFromLlmConfigs(relativePath: string): AbsolutePath;
|
|
59
|
+
resolveFromCache(relativePath: string): AbsolutePath;
|
|
60
|
+
/** local TUI settings (preview mode, last draft per workflow) — gitignored */
|
|
61
|
+
get settingsPath(): AbsolutePath;
|
|
62
|
+
resolveFromHosts(relativePath: string): AbsolutePath;
|
|
63
|
+
/**
|
|
64
|
+
* Resolves a relative path against an absolute path.
|
|
65
|
+
* @param from - The absolute path to resolve from.
|
|
66
|
+
* @param relativePath - The relative path to resolve.
|
|
67
|
+
* @returns The resolved absolute path.
|
|
68
|
+
*/
|
|
69
|
+
resolve(from: AbsolutePath, relativePath: RelativePath): AbsolutePath;
|
|
70
|
+
resolveFromOutput(relativePath: string): AbsolutePath;
|
|
71
|
+
readJSON_: <T>(absPath: AbsolutePath, def?: T) => T;
|
|
72
|
+
autolayoutOpts: {
|
|
73
|
+
node_hsep: number;
|
|
74
|
+
node_vsep: number;
|
|
75
|
+
forceLeft: boolean;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
declare global {
|
|
79
|
+
var comfyts: ComfyTS;
|
|
80
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type ComfyStorage = {
|
|
2
|
+
/** backend name, for error messages */
|
|
3
|
+
kind: string;
|
|
4
|
+
/** throws when missing */
|
|
5
|
+
readText(path: string): string;
|
|
6
|
+
readTextIfExists(path: string): string | null;
|
|
7
|
+
/** throws when missing */
|
|
8
|
+
readBytes(path: string): Uint8Array;
|
|
9
|
+
/** parents are created (mkdirp implied) */
|
|
10
|
+
writeText(path: string, text: string): void;
|
|
11
|
+
/** parents are created (mkdirp implied) */
|
|
12
|
+
writeBytes(path: string, bytes: Uint8Array): void;
|
|
13
|
+
exists(path: string): boolean;
|
|
14
|
+
mkdirp(path: string): void;
|
|
15
|
+
/** file mtime in ms; null when missing */
|
|
16
|
+
mtimeMs(path: string): number | null;
|
|
17
|
+
homedir(): string;
|
|
18
|
+
cwd(): string;
|
|
19
|
+
};
|
|
20
|
+
/** the fs/os surface createNodeStorageFrom needs — structural, so this file
|
|
21
|
+
* never imports node types into the web graph */
|
|
22
|
+
export type NodeFsLike = {
|
|
23
|
+
readFileSync(path: string): Uint8Array;
|
|
24
|
+
readFileSync(path: string, encoding: 'utf8'): string;
|
|
25
|
+
writeFileSync(path: string, data: string | Uint8Array): void;
|
|
26
|
+
existsSync(path: string): boolean;
|
|
27
|
+
mkdirSync(path: string, opts: {
|
|
28
|
+
recursive: boolean;
|
|
29
|
+
}): unknown;
|
|
30
|
+
statSync(path: string): {
|
|
31
|
+
mtimeMs: number;
|
|
32
|
+
isFile(): boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type NodeOsLike = {
|
|
36
|
+
homedir(): string;
|
|
37
|
+
};
|
|
38
|
+
/** node backend built from INJECTED modules: nodeStorage.ts passes its static
|
|
39
|
+
* imports, the autodetect below passes process.getBuiltinModule results */
|
|
40
|
+
export declare function createNodeStorageFrom(fs: NodeFsLike, os: NodeOsLike): ComfyStorage;
|
|
41
|
+
/** in-memory backend: the web default, also handy for hermetic tests.
|
|
42
|
+
* Paths are LITERAL keys (no normalization — core callers resolve through
|
|
43
|
+
* pathe/comfyts already). exists() knows written files and EXPLICIT mkdirp
|
|
44
|
+
* dirs only, never implicit parents. Bytes are copied in AND out so neither
|
|
45
|
+
* side can mutate the store. */
|
|
46
|
+
export declare function createMemoryStorage(p?: {
|
|
47
|
+
homedir?: string;
|
|
48
|
+
cwd?: string;
|
|
49
|
+
}): ComfyStorage;
|
|
50
|
+
/** entries call this at import time: index.ts installs node, web.ts memory */
|
|
51
|
+
export declare function setDefaultComfyStorage(storage: ComfyStorage): void;
|
|
52
|
+
export declare function resolveComfyStorage(explicit?: ComfyStorage): ComfyStorage;
|
|
53
|
+
/** the ONE accessor call sites use: the instance's storage when the global
|
|
54
|
+
* exists, the resolved default otherwise (vars constructed before create()) */
|
|
55
|
+
export declare function getComfyStorage(): ComfyStorage;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type ComfyStorage = {
|
|
2
|
+
/** backend name, for error messages */
|
|
3
|
+
kind: string;
|
|
4
|
+
/** throws when missing */
|
|
5
|
+
readText(path: string): string;
|
|
6
|
+
readTextIfExists(path: string): string | null;
|
|
7
|
+
/** throws when missing */
|
|
8
|
+
readBytes(path: string): Uint8Array;
|
|
9
|
+
/** parents are created (mkdirp implied) */
|
|
10
|
+
writeText(path: string, text: string): void;
|
|
11
|
+
/** parents are created (mkdirp implied) */
|
|
12
|
+
writeBytes(path: string, bytes: Uint8Array): void;
|
|
13
|
+
exists(path: string): boolean;
|
|
14
|
+
mkdirp(path: string): void;
|
|
15
|
+
/** file mtime in ms; null when missing */
|
|
16
|
+
mtimeMs(path: string): number | null;
|
|
17
|
+
homedir(): string;
|
|
18
|
+
cwd(): string;
|
|
19
|
+
};
|
|
20
|
+
/** the fs/os surface createNodeStorageFrom needs — structural, so this file
|
|
21
|
+
* never imports node types into the web graph */
|
|
22
|
+
export type NodeFsLike = {
|
|
23
|
+
readFileSync(path: string): Uint8Array;
|
|
24
|
+
readFileSync(path: string, encoding: 'utf8'): string;
|
|
25
|
+
writeFileSync(path: string, data: string | Uint8Array): void;
|
|
26
|
+
existsSync(path: string): boolean;
|
|
27
|
+
mkdirSync(path: string, opts: {
|
|
28
|
+
recursive: boolean;
|
|
29
|
+
}): unknown;
|
|
30
|
+
statSync(path: string): {
|
|
31
|
+
mtimeMs: number;
|
|
32
|
+
isFile(): boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type NodeOsLike = {
|
|
36
|
+
homedir(): string;
|
|
37
|
+
};
|
|
38
|
+
/** node backend built from INJECTED modules: nodeStorage.ts passes its static
|
|
39
|
+
* imports, the autodetect below passes process.getBuiltinModule results */
|
|
40
|
+
export declare function createNodeStorageFrom(fs: NodeFsLike, os: NodeOsLike): ComfyStorage;
|
|
41
|
+
/** in-memory backend: the web default, also handy for hermetic tests.
|
|
42
|
+
* Paths are LITERAL keys (no normalization — core callers resolve through
|
|
43
|
+
* pathe/comfyts already). exists() knows written files and EXPLICIT mkdirp
|
|
44
|
+
* dirs only, never implicit parents. Bytes are copied in AND out so neither
|
|
45
|
+
* side can mutate the store. */
|
|
46
|
+
export declare function createMemoryStorage(p?: {
|
|
47
|
+
homedir?: string;
|
|
48
|
+
cwd?: string;
|
|
49
|
+
}): ComfyStorage;
|
|
50
|
+
/** entries call this at import time: index.ts installs node, web.ts memory */
|
|
51
|
+
export declare function setDefaultComfyStorage(storage: ComfyStorage): void;
|
|
52
|
+
export declare function resolveComfyStorage(explicit?: ComfyStorage): ComfyStorage;
|
|
53
|
+
/** the ONE accessor call sites use: the instance's storage when the global
|
|
54
|
+
* exists, the resolved default otherwise (vars constructed before create()) */
|
|
55
|
+
export declare function getComfyStorage(): ComfyStorage;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ComfyNode } from '../graph/ComfyNode.cjs';
|
|
2
|
+
import type { ComfyNodeMetadata } from '../graph/ComfyNodeID.cjs';
|
|
3
|
+
import type { ComfyNodeOutput } from '../graph/ComfyNodeOutput.cjs';
|
|
4
|
+
export type BaseNodeInputs = Record<string, unknown>;
|
|
5
|
+
export type BaseNodeOutputs = Record<string, ComfyNodeOutput<string, number>>;
|
|
6
|
+
export type BaseNode = ComfyNode<BaseNodeInputs, BaseNodeOutputs>;
|
|
7
|
+
export type BaseNodeFactory = (inputs: BaseNodeInputs, meta?: ComfyNodeMetadata) => BaseNode;
|
|
8
|
+
declare global {
|
|
9
|
+
namespace Comfy {
|
|
10
|
+
/**
|
|
11
|
+
* registry of generated per-host SDKs.
|
|
12
|
+
* each generated `output/hosts/<id>/sdk.d.ts` merges one entry:
|
|
13
|
+
*
|
|
14
|
+
* interface Hosts { 'windows-1': Windows1.Sdk }
|
|
15
|
+
*
|
|
16
|
+
* `SdkForHost<'windows-1'>` then resolves to the precise types of that host.
|
|
17
|
+
*/
|
|
18
|
+
interface Hosts {
|
|
19
|
+
}
|
|
20
|
+
interface Accepts {
|
|
21
|
+
[slotTypeName: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
interface Slots {
|
|
24
|
+
[slotName: string]: string;
|
|
25
|
+
}
|
|
26
|
+
interface Union {
|
|
27
|
+
[unionName: string]: string | number | boolean;
|
|
28
|
+
}
|
|
29
|
+
interface IN {
|
|
30
|
+
[nodeName: string]: BaseNodeInputs;
|
|
31
|
+
}
|
|
32
|
+
interface OUT {
|
|
33
|
+
[nodeName: string]: BaseNodeOutputs;
|
|
34
|
+
}
|
|
35
|
+
interface Node {
|
|
36
|
+
[nodeName: string]: BaseNode;
|
|
37
|
+
}
|
|
38
|
+
interface Builder {
|
|
39
|
+
[nodeName: string]: BaseNodeFactory;
|
|
40
|
+
}
|
|
41
|
+
interface Producer {
|
|
42
|
+
[slotTypeName: string]: Partial<Builder>;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** the shape every generated per-host Sdk interface follows */
|
|
47
|
+
export interface ComfySdkShape {
|
|
48
|
+
IN: object;
|
|
49
|
+
OUT: object;
|
|
50
|
+
Node: object;
|
|
51
|
+
Builder: object;
|
|
52
|
+
Slots: object;
|
|
53
|
+
Accepts: object;
|
|
54
|
+
Union: object;
|
|
55
|
+
Producer: object;
|
|
56
|
+
Embeddings: string;
|
|
57
|
+
}
|
|
58
|
+
/** fallback sdk: the permissive base surface above */
|
|
59
|
+
export interface ComfySdkBase extends ComfySdkShape {
|
|
60
|
+
IN: Comfy.IN;
|
|
61
|
+
OUT: Comfy.OUT;
|
|
62
|
+
Node: Comfy.Node;
|
|
63
|
+
Builder: Comfy.Builder;
|
|
64
|
+
Slots: Comfy.Slots;
|
|
65
|
+
Accepts: Comfy.Accepts;
|
|
66
|
+
Union: Comfy.Union;
|
|
67
|
+
Producer: Comfy.Producer;
|
|
68
|
+
Embeddings: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* resolve the sdk types for a given host id:
|
|
72
|
+
* precise generated types when `Comfy.Hosts` has an entry, base types otherwise.
|
|
73
|
+
*
|
|
74
|
+
* The `[keyof Comfy.Hosts] extends [never]` guard is load-bearing, not style:
|
|
75
|
+
* with an EMPTY registry (no sdk.d.ts anywhere, i.e. a fresh clone or a consumer
|
|
76
|
+
* before their first codegen) `ID extends keyof Comfy.Hosts` stays a DEFERRED
|
|
77
|
+
* conditional for any generic ID. A deferred type in the contravariant `build`
|
|
78
|
+
* parameter of DefineWorkflowSpec makes `ComfyHost<ID>` unassignable to
|
|
79
|
+
* `ComfyHost<string>`, and 10 errors erupt across state/ComfyHost/ComfyWorkflow/
|
|
80
|
+
* MediaImage. Resolving to the base sdk EAGERLY when the registry is empty keeps
|
|
81
|
+
* the library typechecking with nothing generated on disk (frozen invariant).
|
|
82
|
+
*/
|
|
83
|
+
export type SdkForHost<ID extends string> = [keyof Comfy.Hosts] extends [never] ? ComfySdkBase : ID extends keyof Comfy.Hosts ? Comfy.Hosts[ID] extends ComfySdkShape ? Comfy.Hosts[ID] : ComfySdkBase : ComfySdkBase;
|
|
84
|
+
/** the typed node K of host ID (falls back to BaseNode when unknown) */
|
|
85
|
+
export type NodeOf<ID extends string, K extends string> = SdkForHost<ID>['Node'] extends infer N ? K extends keyof N ? N[K] : BaseNode : BaseNode;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ComfyNode } from '../graph/ComfyNode.js';
|
|
2
|
+
import type { ComfyNodeMetadata } from '../graph/ComfyNodeID.js';
|
|
3
|
+
import type { ComfyNodeOutput } from '../graph/ComfyNodeOutput.js';
|
|
4
|
+
export type BaseNodeInputs = Record<string, unknown>;
|
|
5
|
+
export type BaseNodeOutputs = Record<string, ComfyNodeOutput<string, number>>;
|
|
6
|
+
export type BaseNode = ComfyNode<BaseNodeInputs, BaseNodeOutputs>;
|
|
7
|
+
export type BaseNodeFactory = (inputs: BaseNodeInputs, meta?: ComfyNodeMetadata) => BaseNode;
|
|
8
|
+
declare global {
|
|
9
|
+
namespace Comfy {
|
|
10
|
+
/**
|
|
11
|
+
* registry of generated per-host SDKs.
|
|
12
|
+
* each generated `output/hosts/<id>/sdk.d.ts` merges one entry:
|
|
13
|
+
*
|
|
14
|
+
* interface Hosts { 'windows-1': Windows1.Sdk }
|
|
15
|
+
*
|
|
16
|
+
* `SdkForHost<'windows-1'>` then resolves to the precise types of that host.
|
|
17
|
+
*/
|
|
18
|
+
interface Hosts {
|
|
19
|
+
}
|
|
20
|
+
interface Accepts {
|
|
21
|
+
[slotTypeName: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
interface Slots {
|
|
24
|
+
[slotName: string]: string;
|
|
25
|
+
}
|
|
26
|
+
interface Union {
|
|
27
|
+
[unionName: string]: string | number | boolean;
|
|
28
|
+
}
|
|
29
|
+
interface IN {
|
|
30
|
+
[nodeName: string]: BaseNodeInputs;
|
|
31
|
+
}
|
|
32
|
+
interface OUT {
|
|
33
|
+
[nodeName: string]: BaseNodeOutputs;
|
|
34
|
+
}
|
|
35
|
+
interface Node {
|
|
36
|
+
[nodeName: string]: BaseNode;
|
|
37
|
+
}
|
|
38
|
+
interface Builder {
|
|
39
|
+
[nodeName: string]: BaseNodeFactory;
|
|
40
|
+
}
|
|
41
|
+
interface Producer {
|
|
42
|
+
[slotTypeName: string]: Partial<Builder>;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** the shape every generated per-host Sdk interface follows */
|
|
47
|
+
export interface ComfySdkShape {
|
|
48
|
+
IN: object;
|
|
49
|
+
OUT: object;
|
|
50
|
+
Node: object;
|
|
51
|
+
Builder: object;
|
|
52
|
+
Slots: object;
|
|
53
|
+
Accepts: object;
|
|
54
|
+
Union: object;
|
|
55
|
+
Producer: object;
|
|
56
|
+
Embeddings: string;
|
|
57
|
+
}
|
|
58
|
+
/** fallback sdk: the permissive base surface above */
|
|
59
|
+
export interface ComfySdkBase extends ComfySdkShape {
|
|
60
|
+
IN: Comfy.IN;
|
|
61
|
+
OUT: Comfy.OUT;
|
|
62
|
+
Node: Comfy.Node;
|
|
63
|
+
Builder: Comfy.Builder;
|
|
64
|
+
Slots: Comfy.Slots;
|
|
65
|
+
Accepts: Comfy.Accepts;
|
|
66
|
+
Union: Comfy.Union;
|
|
67
|
+
Producer: Comfy.Producer;
|
|
68
|
+
Embeddings: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* resolve the sdk types for a given host id:
|
|
72
|
+
* precise generated types when `Comfy.Hosts` has an entry, base types otherwise.
|
|
73
|
+
*
|
|
74
|
+
* The `[keyof Comfy.Hosts] extends [never]` guard is load-bearing, not style:
|
|
75
|
+
* with an EMPTY registry (no sdk.d.ts anywhere, i.e. a fresh clone or a consumer
|
|
76
|
+
* before their first codegen) `ID extends keyof Comfy.Hosts` stays a DEFERRED
|
|
77
|
+
* conditional for any generic ID. A deferred type in the contravariant `build`
|
|
78
|
+
* parameter of DefineWorkflowSpec makes `ComfyHost<ID>` unassignable to
|
|
79
|
+
* `ComfyHost<string>`, and 10 errors erupt across state/ComfyHost/ComfyWorkflow/
|
|
80
|
+
* MediaImage. Resolving to the base sdk EAGERLY when the registry is empty keeps
|
|
81
|
+
* the library typechecking with nothing generated on disk (frozen invariant).
|
|
82
|
+
*/
|
|
83
|
+
export type SdkForHost<ID extends string> = [keyof Comfy.Hosts] extends [never] ? ComfySdkBase : ID extends keyof Comfy.Hosts ? Comfy.Hosts[ID] extends ComfySdkShape ? Comfy.Hosts[ID] : ComfySdkBase : ComfySdkBase;
|
|
84
|
+
/** the typed node K of host ID (falls back to BaseNode when unknown) */
|
|
85
|
+
export type NodeOf<ID extends string, K extends string> = SdkForHost<ID>['Node'] extends infer N ? K extends keyof N ? N[K] : BaseNode : BaseNode;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type Flavor<T, FlavorT> = T & {
|
|
2
|
+
__tag?: FlavorT;
|
|
3
|
+
};
|
|
4
|
+
export type Tagged<O, Tag> = O & {
|
|
5
|
+
__tag?: Tag;
|
|
6
|
+
};
|
|
7
|
+
export type Branded<O, Brand extends {
|
|
8
|
+
[key: string]: true;
|
|
9
|
+
}> = O & Brand;
|
|
10
|
+
export type Maybe<T> = T | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Make some keys optional
|
|
13
|
+
* Usage: PartialOmit<{ a: string, b: string }, 'a'> -> { a?: string, b: string }
|
|
14
|
+
*/
|
|
15
|
+
export type PartialOmit<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
16
|
+
export type IsEqual<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
|
|
17
|
+
export type EmptyRecord = Record<never, never>;
|
|
18
|
+
export type number_Timestamp = Tagged<number, 'Timestamp'>;
|
|
19
|
+
export type AbsolutePath = Tagged<string, {
|
|
20
|
+
AbsolutePath: true;
|
|
21
|
+
}>;
|
|
22
|
+
export type RelativePath = Tagged<string, {
|
|
23
|
+
RelativePath: true;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const asAbsolutePath: (path: string) => AbsolutePath;
|
|
26
|
+
export declare const asRelativePath: (path: string) => RelativePath;
|
|
27
|
+
export type ConvertibleImageFormat = 'image/png' | 'image/jpeg' | 'image/webp' | 'raw';
|
|
28
|
+
/** local disk saving is OPT-IN per run: `save: true` = raw bytes, an object re-encodes/relocates */
|
|
29
|
+
export type SaveOptions = {
|
|
30
|
+
/** 'raw' (default) writes the bytes untouched; an image/* mime re-encodes through sharp */
|
|
31
|
+
format?: ConvertibleImageFormat;
|
|
32
|
+
/** local dir under `.comfy-ts/outputs/` (wins over the prompt's own filename_prefix) */
|
|
33
|
+
prefix?: string;
|
|
34
|
+
/** 0..1, re-encode only */
|
|
35
|
+
quality?: number;
|
|
36
|
+
};
|
|
37
|
+
export type Either<L, R> = {
|
|
38
|
+
success: false;
|
|
39
|
+
value: L;
|
|
40
|
+
} | {
|
|
41
|
+
success: true;
|
|
42
|
+
value: R;
|
|
43
|
+
};
|
|
44
|
+
export declare const resultSuccess: <T>(value: T) => Either<never, T>;
|
|
45
|
+
export declare const resultFailure: <T>(value: T) => Either<T, never>;
|
|
46
|
+
export type ResultFailure = {
|
|
47
|
+
success: false;
|
|
48
|
+
message: string;
|
|
49
|
+
error: unknown;
|
|
50
|
+
value: undefined;
|
|
51
|
+
};
|
|
52
|
+
export type Result<R> = {
|
|
53
|
+
success: true;
|
|
54
|
+
value: R;
|
|
55
|
+
} | ResultFailure;
|
|
56
|
+
export declare const __OK: <T>(value: T) => Result<T>;
|
|
57
|
+
export declare const __FAIL: (message: string, error?: unknown) => Result<any>;
|
|
58
|
+
export type MDContent = Branded<string, {
|
|
59
|
+
MDContent: true;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const asMDContent: (s: string) => MDContent;
|
|
62
|
+
export type HTMLContent = Branded<string, {
|
|
63
|
+
HTML: true;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const asHTMLContent: (s: string) => HTMLContent;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type Flavor<T, FlavorT> = T & {
|
|
2
|
+
__tag?: FlavorT;
|
|
3
|
+
};
|
|
4
|
+
export type Tagged<O, Tag> = O & {
|
|
5
|
+
__tag?: Tag;
|
|
6
|
+
};
|
|
7
|
+
export type Branded<O, Brand extends {
|
|
8
|
+
[key: string]: true;
|
|
9
|
+
}> = O & Brand;
|
|
10
|
+
export type Maybe<T> = T | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Make some keys optional
|
|
13
|
+
* Usage: PartialOmit<{ a: string, b: string }, 'a'> -> { a?: string, b: string }
|
|
14
|
+
*/
|
|
15
|
+
export type PartialOmit<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
16
|
+
export type IsEqual<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
|
|
17
|
+
export type EmptyRecord = Record<never, never>;
|
|
18
|
+
export type number_Timestamp = Tagged<number, 'Timestamp'>;
|
|
19
|
+
export type AbsolutePath = Tagged<string, {
|
|
20
|
+
AbsolutePath: true;
|
|
21
|
+
}>;
|
|
22
|
+
export type RelativePath = Tagged<string, {
|
|
23
|
+
RelativePath: true;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const asAbsolutePath: (path: string) => AbsolutePath;
|
|
26
|
+
export declare const asRelativePath: (path: string) => RelativePath;
|
|
27
|
+
export type ConvertibleImageFormat = 'image/png' | 'image/jpeg' | 'image/webp' | 'raw';
|
|
28
|
+
/** local disk saving is OPT-IN per run: `save: true` = raw bytes, an object re-encodes/relocates */
|
|
29
|
+
export type SaveOptions = {
|
|
30
|
+
/** 'raw' (default) writes the bytes untouched; an image/* mime re-encodes through sharp */
|
|
31
|
+
format?: ConvertibleImageFormat;
|
|
32
|
+
/** local dir under `.comfy-ts/outputs/` (wins over the prompt's own filename_prefix) */
|
|
33
|
+
prefix?: string;
|
|
34
|
+
/** 0..1, re-encode only */
|
|
35
|
+
quality?: number;
|
|
36
|
+
};
|
|
37
|
+
export type Either<L, R> = {
|
|
38
|
+
success: false;
|
|
39
|
+
value: L;
|
|
40
|
+
} | {
|
|
41
|
+
success: true;
|
|
42
|
+
value: R;
|
|
43
|
+
};
|
|
44
|
+
export declare const resultSuccess: <T>(value: T) => Either<never, T>;
|
|
45
|
+
export declare const resultFailure: <T>(value: T) => Either<T, never>;
|
|
46
|
+
export type ResultFailure = {
|
|
47
|
+
success: false;
|
|
48
|
+
message: string;
|
|
49
|
+
error: unknown;
|
|
50
|
+
value: undefined;
|
|
51
|
+
};
|
|
52
|
+
export type Result<R> = {
|
|
53
|
+
success: true;
|
|
54
|
+
value: R;
|
|
55
|
+
} | ResultFailure;
|
|
56
|
+
export declare const __OK: <T>(value: T) => Result<T>;
|
|
57
|
+
export declare const __FAIL: (message: string, error?: unknown) => Result<any>;
|
|
58
|
+
export type MDContent = Branded<string, {
|
|
59
|
+
MDContent: true;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const asMDContent: (s: string) => MDContent;
|
|
62
|
+
export type HTMLContent = Branded<string, {
|
|
63
|
+
HTML: true;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const asHTMLContent: (s: string) => HTMLContent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** this class is used to buffer text and then write it to a file */
|
|
2
|
+
export declare class CodeBuffer {
|
|
3
|
+
private _indent;
|
|
4
|
+
tab: string;
|
|
5
|
+
constructor(_indent?: number, lines?: string[]);
|
|
6
|
+
content: string;
|
|
7
|
+
newLine: () => string;
|
|
8
|
+
line: (...txts: string[]) => this;
|
|
9
|
+
append: (str: string) => string;
|
|
10
|
+
writeLine: (txt: string) => this;
|
|
11
|
+
w: (txt: string, opts?: {
|
|
12
|
+
if: boolean;
|
|
13
|
+
}) => void;
|
|
14
|
+
indent: () => number;
|
|
15
|
+
deindent: () => number;
|
|
16
|
+
indented: (fn: () => void) => void;
|
|
17
|
+
bar: (text: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const repeatStr: (x: number, str: string) => string;
|
|
20
|
+
export declare const renderBar: (text: string, prefix?: string) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** this class is used to buffer text and then write it to a file */
|
|
2
|
+
export declare class CodeBuffer {
|
|
3
|
+
private _indent;
|
|
4
|
+
tab: string;
|
|
5
|
+
constructor(_indent?: number, lines?: string[]);
|
|
6
|
+
content: string;
|
|
7
|
+
newLine: () => string;
|
|
8
|
+
line: (...txts: string[]) => this;
|
|
9
|
+
append: (str: string) => string;
|
|
10
|
+
writeLine: (txt: string) => this;
|
|
11
|
+
w: (txt: string, opts?: {
|
|
12
|
+
if: boolean;
|
|
13
|
+
}) => void;
|
|
14
|
+
indent: () => number;
|
|
15
|
+
deindent: () => number;
|
|
16
|
+
indented: (fn: () => void) => void;
|
|
17
|
+
bar: (text: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const repeatStr: (x: number, str: string) => string;
|
|
20
|
+
export declare const renderBar: (text: string, prefix?: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const palette: {
|
|
2
|
+
primitive: string;
|
|
3
|
+
loader: string;
|
|
4
|
+
latent: string;
|
|
5
|
+
conditioning: string;
|
|
6
|
+
sampl: string;
|
|
7
|
+
image: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const paletteKeys: (keyof typeof palette)[];
|
|
10
|
+
export declare const comfyColors: {
|
|
11
|
+
[category: string]: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const getColorForCategory: (_category: string) => string | undefined;
|
|
14
|
+
export declare const getColorForInputNameInComfy: (nameInComfy: string) => string | undefined;
|