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,230 @@
|
|
|
1
|
+
import type { ComfyHost } from '../host/ComfyHost.cjs';
|
|
2
|
+
import type { ComfyNodeId } from '../graph/ComfyNodeID.cjs';
|
|
3
|
+
import { type AbsolutePath, type Maybe, type SaveOptions } from '../types/index.cjs';
|
|
4
|
+
import type { ComfyExecutionStatus } from './ComfyExecutionStatus.cjs';
|
|
5
|
+
import type { ComfyWorkflow, ComfyWorkflowID, ExecutionSnapshot, ProgressReport } from './ComfyWorkflow.cjs';
|
|
6
|
+
import type { ComfyImageInfo, PromptID, PendingWsItem, WsMsgExecutionError, WsMsgExecutionInterrupted } from './ComfyWsApi.cjs';
|
|
7
|
+
import { MediaImage } from './MediaImage.cjs';
|
|
8
|
+
export type ComfyExecutionData = {
|
|
9
|
+
id: PromptID;
|
|
10
|
+
graphID: ComfyWorkflowID;
|
|
11
|
+
executed: boolean;
|
|
12
|
+
error?: WsMsgExecutionError | WsMsgExecutionInterrupted | null;
|
|
13
|
+
/** why comfy-ts failed the run itself, when no ComfyUI message says it (the host lost the prompt) */
|
|
14
|
+
reason?: string | null;
|
|
15
|
+
status?: ComfyExecutionStatus | null;
|
|
16
|
+
};
|
|
17
|
+
/** one audio file an output node published, downloaded as the server wrote it.
|
|
18
|
+
* `absPath` is null when saving is off: `bytes` is then the only copy */
|
|
19
|
+
export type ComfyAudioOutput = {
|
|
20
|
+
nodeId: ComfyNodeId;
|
|
21
|
+
filename: string;
|
|
22
|
+
mime: string;
|
|
23
|
+
bytes: Uint8Array;
|
|
24
|
+
absPath: AbsolutePath | null;
|
|
25
|
+
/** the `tag` / `tags` of the output node's metadata, as on images */
|
|
26
|
+
tags: string[];
|
|
27
|
+
};
|
|
28
|
+
/** one video file an output node published (SaveVideo, SaveWEBM, VHS_VideoCombine), same
|
|
29
|
+
* shape and same retrieval as an audio file */
|
|
30
|
+
export type ComfyVideoOutput = ComfyAudioOutput;
|
|
31
|
+
/** one 3D file an output node published (SaveGLB, SaveGaussianSplat, SavePointCloud): a mesh, a point
|
|
32
|
+
* cloud or a splat, same retrieval as an audio file. `format` is the lowercase extension (glb, ply, spz…) */
|
|
33
|
+
export type Comfy3DOutput = ComfyAudioOutput & {
|
|
34
|
+
format: string;
|
|
35
|
+
};
|
|
36
|
+
/** one text output as an output node published it (`nodeKey` is null when the node left the snapshot) */
|
|
37
|
+
export type ComfyTextOutput = {
|
|
38
|
+
nodeId: ComfyNodeId;
|
|
39
|
+
nodeKey: string | null;
|
|
40
|
+
text: string;
|
|
41
|
+
};
|
|
42
|
+
export type ExecutionProgress = ProgressReport & {
|
|
43
|
+
promptId: PromptID;
|
|
44
|
+
nodeName: string | null;
|
|
45
|
+
elapsedMs: number;
|
|
46
|
+
/** the executing node's OWN counter, in its own unit: sampler steps, or generated
|
|
47
|
+
* tokens on a text node. Null between nodes. The global percent normalizes this away,
|
|
48
|
+
* and the unit is the only live detail worth reading on a long node */
|
|
49
|
+
nodeProgress: {
|
|
50
|
+
value: number;
|
|
51
|
+
max: number;
|
|
52
|
+
} | null;
|
|
53
|
+
/** the executing node's live display text, when it publishes one. A streaming generator
|
|
54
|
+
* puts its partial answer here every few tokens */
|
|
55
|
+
progressText: string | null;
|
|
56
|
+
};
|
|
57
|
+
/** one live preview frame of a run: the image a sampler is forming, once per step */
|
|
58
|
+
export type ExecutionPreview = {
|
|
59
|
+
promptId: PromptID;
|
|
60
|
+
/** the image as ComfyUI encoded it, jpeg or png */
|
|
61
|
+
bytes: Uint8Array;
|
|
62
|
+
mime: string;
|
|
63
|
+
/** the node that sent the frame: the frame's own metadata when it names one (type 4 frames),
|
|
64
|
+
* else the node executing when it arrived. Null when neither is known */
|
|
65
|
+
nodeId: ComfyNodeId | null;
|
|
66
|
+
/** that node's class name in the sent prompt (`KSampler`), null when unknown */
|
|
67
|
+
nodeName: string | null;
|
|
68
|
+
/** that node's own counter when the frame arrived (sampler step of total), null when unknown */
|
|
69
|
+
step: {
|
|
70
|
+
value: number;
|
|
71
|
+
max: number;
|
|
72
|
+
} | null;
|
|
73
|
+
/** the raw metadata json of a type 4 frame (`node_id`, `prompt_id`, …), null on a type 1 frame */
|
|
74
|
+
metadata: unknown;
|
|
75
|
+
};
|
|
76
|
+
export declare class ComfyExecution {
|
|
77
|
+
workflow: ComfyWorkflow;
|
|
78
|
+
data: ComfyExecutionData;
|
|
79
|
+
get host(): ComfyHost;
|
|
80
|
+
constructor(workflow: ComfyWorkflow, data: ComfyExecutionData, init?: {
|
|
81
|
+
snapshot?: ExecutionSnapshot;
|
|
82
|
+
save?: Maybe<boolean | SaveOptions>;
|
|
83
|
+
scrubHistory?: boolean;
|
|
84
|
+
ephemeral?: boolean;
|
|
85
|
+
onProgress?: Maybe<(p: ExecutionProgress) => void>;
|
|
86
|
+
onPreview?: Maybe<(p: ExecutionPreview) => void>;
|
|
87
|
+
logProgress?: boolean;
|
|
88
|
+
});
|
|
89
|
+
/** local disk saving, OPT-IN (architecture.md item 14); null = outputs stay in memory */
|
|
90
|
+
save: Maybe<SaveOptions>;
|
|
91
|
+
/** delete this run's server history entry after `done` */
|
|
92
|
+
scrubHistory: boolean;
|
|
93
|
+
/** this run's SaveImage nodes were rewritten to SaveImageWebsocket in the snapshot */
|
|
94
|
+
ephemeral: boolean;
|
|
95
|
+
/** exactly what was sent to the host, frozen at send time (replayable) */
|
|
96
|
+
snapshot: Maybe<ExecutionSnapshot>;
|
|
97
|
+
/** called on every progress-relevant websocket message */
|
|
98
|
+
onProgress: Maybe<(p: ExecutionProgress) => void>;
|
|
99
|
+
/** called on every live preview frame of this run. Null = frames are never decoded for it */
|
|
100
|
+
onPreview: Maybe<(p: ExecutionPreview) => void>;
|
|
101
|
+
/** render a live single-line progress report to the console */
|
|
102
|
+
logProgress: boolean;
|
|
103
|
+
readonly startedAt: number;
|
|
104
|
+
get progress(): ExecutionProgress;
|
|
105
|
+
private _lastLoggedLine;
|
|
106
|
+
private emitProgress;
|
|
107
|
+
private finishProgressLine;
|
|
108
|
+
private _resolve;
|
|
109
|
+
done: Promise<this>;
|
|
110
|
+
log(...args: unknown[]): void;
|
|
111
|
+
onCreate(): void;
|
|
112
|
+
get progressGlobal(): ProgressReport;
|
|
113
|
+
get status(): 'New' | 'Scheduled' | 'Running' | 'Success' | 'Failure';
|
|
114
|
+
onPromptRelatedMessage: (msg: PendingWsItem) => void;
|
|
115
|
+
/** update pointer to the currently executing node */
|
|
116
|
+
private onExecuting;
|
|
117
|
+
private onExecutionSuccess;
|
|
118
|
+
private onError;
|
|
119
|
+
/** update execution list */
|
|
120
|
+
private onExecuted;
|
|
121
|
+
private pendingPromises;
|
|
122
|
+
/** an end message arrived (or was replayed): every later message is ignored */
|
|
123
|
+
private ended;
|
|
124
|
+
/** the output nodes whose `executed` reached us, so a /history replay never retrieves one twice */
|
|
125
|
+
private heardExecuted;
|
|
126
|
+
/** the run lived through a reconnect and may have lost events: its end reads /history for them */
|
|
127
|
+
private mayHaveMissedEvents;
|
|
128
|
+
private replayUnheardOutputs;
|
|
129
|
+
/** the history entry is written right after the end message is queued, so it may lag by a moment */
|
|
130
|
+
historyRetry: {
|
|
131
|
+
tries: number;
|
|
132
|
+
ms: number;
|
|
133
|
+
};
|
|
134
|
+
/** a run that lived through a reconnect: an output node that ended in the gap is only in /history */
|
|
135
|
+
private retrieveMissedOutputs;
|
|
136
|
+
/** @internal the last event of this run: the watchdog checks only runs quiet for host.runSilenceMs */
|
|
137
|
+
lastHeardAt: number;
|
|
138
|
+
/** @internal a check is in flight: never two at once */
|
|
139
|
+
reconciling: boolean;
|
|
140
|
+
private loggedReconcileProblems;
|
|
141
|
+
private heard;
|
|
142
|
+
private logReconcileOnce;
|
|
143
|
+
/** @internal called before the host reads its queue. After a reconnect the run may have lost events,
|
|
144
|
+
* so its end reads /history for them; the flag is set before any await, so a live end that lands
|
|
145
|
+
* during the reads still looks. A check for silence alone does not set it: a quiet run lost nothing */
|
|
146
|
+
beginReconcile(why: 'reconnect' | 'silence'): void;
|
|
147
|
+
/** @internal ask the host where this run stands. `queued` is the host's queue read BEFORE this
|
|
148
|
+
* history read (the server moves a prompt from one to the other under one lock, so this order never
|
|
149
|
+
* misses a run that ended between the two reads); null when it did not answer, and then the run is
|
|
150
|
+
* never declared lost. A queued run needs no history read. Says how the check ended */
|
|
151
|
+
reconcile: (queued: Set<string> | null) => Promise<'history' | 'waiting' | 'lost'>;
|
|
152
|
+
/** audio retrievals that failed (their files are missing from `audios`) */
|
|
153
|
+
audioErrors: {
|
|
154
|
+
audio: ComfyImageInfo;
|
|
155
|
+
error: unknown;
|
|
156
|
+
}[];
|
|
157
|
+
/** audio files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
158
|
+
audios: ComfyAudioOutput[];
|
|
159
|
+
/** video retrievals that failed (their files are missing from `videos`) */
|
|
160
|
+
videoErrors: {
|
|
161
|
+
video: ComfyImageInfo;
|
|
162
|
+
error: unknown;
|
|
163
|
+
}[];
|
|
164
|
+
/** video files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
165
|
+
videos: ComfyVideoOutput[];
|
|
166
|
+
/** 3D retrievals that failed (their files are missing from `models3d`) */
|
|
167
|
+
models3dErrors: {
|
|
168
|
+
model3d: ComfyImageInfo;
|
|
169
|
+
error: unknown;
|
|
170
|
+
}[];
|
|
171
|
+
/** 3D files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
172
|
+
models3d: Comfy3DOutput[];
|
|
173
|
+
/** one non-image file through /view, its bytes as the server wrote them; the caller files it */
|
|
174
|
+
private retrieveFile;
|
|
175
|
+
/** image retrievals that failed (their images are missing from `images`);
|
|
176
|
+
* `image` is null for SaveImageWebsocket frames (no server-side file info exists) */
|
|
177
|
+
imageErrors: {
|
|
178
|
+
image: Maybe<ComfyImageInfo>;
|
|
179
|
+
error: unknown;
|
|
180
|
+
}[];
|
|
181
|
+
retrieveImage: (comfyImageInfo: ComfyImageInfo, promptNodeID: ComfyNodeId) => Promise<void>;
|
|
182
|
+
/** re-encode when asked, then write under OUR local naming — never the raw
|
|
183
|
+
* server filename: a cloud host resets its _00001_ counter per run, so the
|
|
184
|
+
* server name overwrote the same local file on every run */
|
|
185
|
+
private encodeAndWrite;
|
|
186
|
+
/** accumulate an output on the prompt; tags from node metadata ride along */
|
|
187
|
+
private pushImage;
|
|
188
|
+
/** the tags an output node was built with (`{ tag }` / `{ tags }` metadata) */
|
|
189
|
+
private tagsOf;
|
|
190
|
+
/** the sent graph saves through SaveImageWebsocket: those outputs exist only as ws frames */
|
|
191
|
+
private get sendsWsFrames();
|
|
192
|
+
/** true while the currently executing node is a SaveImageWebsocket in the
|
|
193
|
+
* SENT snapshot (the ephemeral rewrite only touches the snapshot, so the
|
|
194
|
+
* live graph may still say SaveImage) — binary frames are then OUTPUTS */
|
|
195
|
+
get wsOutputNodeExecuting(): boolean;
|
|
196
|
+
/** @internal a live preview frame of this run; never an output (the host routes ws saver frames
|
|
197
|
+
* to onWsImageOutput before they get here) */
|
|
198
|
+
onPreviewFrame(p: {
|
|
199
|
+
bytes: Uint8Array;
|
|
200
|
+
mime: string;
|
|
201
|
+
metadata: unknown;
|
|
202
|
+
}): void;
|
|
203
|
+
/** one binary ws frame = one output image of the executing SaveImageWebsocket
|
|
204
|
+
* node (architecture.md item 14 — the zero-server-disk path) */
|
|
205
|
+
onWsImageOutput: (p: {
|
|
206
|
+
bytes: Uint8Array;
|
|
207
|
+
mime: string;
|
|
208
|
+
}) => void;
|
|
209
|
+
private storeWsImage;
|
|
210
|
+
/** images retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
211
|
+
images: MediaImage[];
|
|
212
|
+
/** text outputs emitted for this execution, in arrival order (final once `done` resolves) */
|
|
213
|
+
texts: ComfyTextOutput[];
|
|
214
|
+
/** live display text per node WHILE it runs, newest wins (`send_progress_text` is a
|
|
215
|
+
* replacement, not a delta). This is the only channel carrying text DURING a node: a
|
|
216
|
+
* generator that streams its tokens shows up here, and nowhere in the final outputs */
|
|
217
|
+
progressTexts: Map<string, string>;
|
|
218
|
+
/** the node that most recently published live text — what "watch it work" means */
|
|
219
|
+
progressText: string | null;
|
|
220
|
+
/** @internal a live-text frame for one node */
|
|
221
|
+
onProgressText(p: {
|
|
222
|
+
nodeId: string;
|
|
223
|
+
text: string;
|
|
224
|
+
}): void;
|
|
225
|
+
/** the last text output, the one a single-generator workflow means by "the result" */
|
|
226
|
+
get text(): string | null;
|
|
227
|
+
update(data: Partial<ComfyExecutionData>): void;
|
|
228
|
+
private alreadyDone;
|
|
229
|
+
private _finish;
|
|
230
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { ComfyHost } from '../host/ComfyHost.js';
|
|
2
|
+
import type { ComfyNodeId } from '../graph/ComfyNodeID.js';
|
|
3
|
+
import { type AbsolutePath, type Maybe, type SaveOptions } from '../types/index.js';
|
|
4
|
+
import type { ComfyExecutionStatus } from './ComfyExecutionStatus.js';
|
|
5
|
+
import type { ComfyWorkflow, ComfyWorkflowID, ExecutionSnapshot, ProgressReport } from './ComfyWorkflow.js';
|
|
6
|
+
import type { ComfyImageInfo, PromptID, PendingWsItem, WsMsgExecutionError, WsMsgExecutionInterrupted } from './ComfyWsApi.js';
|
|
7
|
+
import { MediaImage } from './MediaImage.js';
|
|
8
|
+
export type ComfyExecutionData = {
|
|
9
|
+
id: PromptID;
|
|
10
|
+
graphID: ComfyWorkflowID;
|
|
11
|
+
executed: boolean;
|
|
12
|
+
error?: WsMsgExecutionError | WsMsgExecutionInterrupted | null;
|
|
13
|
+
/** why comfy-ts failed the run itself, when no ComfyUI message says it (the host lost the prompt) */
|
|
14
|
+
reason?: string | null;
|
|
15
|
+
status?: ComfyExecutionStatus | null;
|
|
16
|
+
};
|
|
17
|
+
/** one audio file an output node published, downloaded as the server wrote it.
|
|
18
|
+
* `absPath` is null when saving is off: `bytes` is then the only copy */
|
|
19
|
+
export type ComfyAudioOutput = {
|
|
20
|
+
nodeId: ComfyNodeId;
|
|
21
|
+
filename: string;
|
|
22
|
+
mime: string;
|
|
23
|
+
bytes: Uint8Array;
|
|
24
|
+
absPath: AbsolutePath | null;
|
|
25
|
+
/** the `tag` / `tags` of the output node's metadata, as on images */
|
|
26
|
+
tags: string[];
|
|
27
|
+
};
|
|
28
|
+
/** one video file an output node published (SaveVideo, SaveWEBM, VHS_VideoCombine), same
|
|
29
|
+
* shape and same retrieval as an audio file */
|
|
30
|
+
export type ComfyVideoOutput = ComfyAudioOutput;
|
|
31
|
+
/** one 3D file an output node published (SaveGLB, SaveGaussianSplat, SavePointCloud): a mesh, a point
|
|
32
|
+
* cloud or a splat, same retrieval as an audio file. `format` is the lowercase extension (glb, ply, spz…) */
|
|
33
|
+
export type Comfy3DOutput = ComfyAudioOutput & {
|
|
34
|
+
format: string;
|
|
35
|
+
};
|
|
36
|
+
/** one text output as an output node published it (`nodeKey` is null when the node left the snapshot) */
|
|
37
|
+
export type ComfyTextOutput = {
|
|
38
|
+
nodeId: ComfyNodeId;
|
|
39
|
+
nodeKey: string | null;
|
|
40
|
+
text: string;
|
|
41
|
+
};
|
|
42
|
+
export type ExecutionProgress = ProgressReport & {
|
|
43
|
+
promptId: PromptID;
|
|
44
|
+
nodeName: string | null;
|
|
45
|
+
elapsedMs: number;
|
|
46
|
+
/** the executing node's OWN counter, in its own unit: sampler steps, or generated
|
|
47
|
+
* tokens on a text node. Null between nodes. The global percent normalizes this away,
|
|
48
|
+
* and the unit is the only live detail worth reading on a long node */
|
|
49
|
+
nodeProgress: {
|
|
50
|
+
value: number;
|
|
51
|
+
max: number;
|
|
52
|
+
} | null;
|
|
53
|
+
/** the executing node's live display text, when it publishes one. A streaming generator
|
|
54
|
+
* puts its partial answer here every few tokens */
|
|
55
|
+
progressText: string | null;
|
|
56
|
+
};
|
|
57
|
+
/** one live preview frame of a run: the image a sampler is forming, once per step */
|
|
58
|
+
export type ExecutionPreview = {
|
|
59
|
+
promptId: PromptID;
|
|
60
|
+
/** the image as ComfyUI encoded it, jpeg or png */
|
|
61
|
+
bytes: Uint8Array;
|
|
62
|
+
mime: string;
|
|
63
|
+
/** the node that sent the frame: the frame's own metadata when it names one (type 4 frames),
|
|
64
|
+
* else the node executing when it arrived. Null when neither is known */
|
|
65
|
+
nodeId: ComfyNodeId | null;
|
|
66
|
+
/** that node's class name in the sent prompt (`KSampler`), null when unknown */
|
|
67
|
+
nodeName: string | null;
|
|
68
|
+
/** that node's own counter when the frame arrived (sampler step of total), null when unknown */
|
|
69
|
+
step: {
|
|
70
|
+
value: number;
|
|
71
|
+
max: number;
|
|
72
|
+
} | null;
|
|
73
|
+
/** the raw metadata json of a type 4 frame (`node_id`, `prompt_id`, …), null on a type 1 frame */
|
|
74
|
+
metadata: unknown;
|
|
75
|
+
};
|
|
76
|
+
export declare class ComfyExecution {
|
|
77
|
+
workflow: ComfyWorkflow;
|
|
78
|
+
data: ComfyExecutionData;
|
|
79
|
+
get host(): ComfyHost;
|
|
80
|
+
constructor(workflow: ComfyWorkflow, data: ComfyExecutionData, init?: {
|
|
81
|
+
snapshot?: ExecutionSnapshot;
|
|
82
|
+
save?: Maybe<boolean | SaveOptions>;
|
|
83
|
+
scrubHistory?: boolean;
|
|
84
|
+
ephemeral?: boolean;
|
|
85
|
+
onProgress?: Maybe<(p: ExecutionProgress) => void>;
|
|
86
|
+
onPreview?: Maybe<(p: ExecutionPreview) => void>;
|
|
87
|
+
logProgress?: boolean;
|
|
88
|
+
});
|
|
89
|
+
/** local disk saving, OPT-IN (architecture.md item 14); null = outputs stay in memory */
|
|
90
|
+
save: Maybe<SaveOptions>;
|
|
91
|
+
/** delete this run's server history entry after `done` */
|
|
92
|
+
scrubHistory: boolean;
|
|
93
|
+
/** this run's SaveImage nodes were rewritten to SaveImageWebsocket in the snapshot */
|
|
94
|
+
ephemeral: boolean;
|
|
95
|
+
/** exactly what was sent to the host, frozen at send time (replayable) */
|
|
96
|
+
snapshot: Maybe<ExecutionSnapshot>;
|
|
97
|
+
/** called on every progress-relevant websocket message */
|
|
98
|
+
onProgress: Maybe<(p: ExecutionProgress) => void>;
|
|
99
|
+
/** called on every live preview frame of this run. Null = frames are never decoded for it */
|
|
100
|
+
onPreview: Maybe<(p: ExecutionPreview) => void>;
|
|
101
|
+
/** render a live single-line progress report to the console */
|
|
102
|
+
logProgress: boolean;
|
|
103
|
+
readonly startedAt: number;
|
|
104
|
+
get progress(): ExecutionProgress;
|
|
105
|
+
private _lastLoggedLine;
|
|
106
|
+
private emitProgress;
|
|
107
|
+
private finishProgressLine;
|
|
108
|
+
private _resolve;
|
|
109
|
+
done: Promise<this>;
|
|
110
|
+
log(...args: unknown[]): void;
|
|
111
|
+
onCreate(): void;
|
|
112
|
+
get progressGlobal(): ProgressReport;
|
|
113
|
+
get status(): 'New' | 'Scheduled' | 'Running' | 'Success' | 'Failure';
|
|
114
|
+
onPromptRelatedMessage: (msg: PendingWsItem) => void;
|
|
115
|
+
/** update pointer to the currently executing node */
|
|
116
|
+
private onExecuting;
|
|
117
|
+
private onExecutionSuccess;
|
|
118
|
+
private onError;
|
|
119
|
+
/** update execution list */
|
|
120
|
+
private onExecuted;
|
|
121
|
+
private pendingPromises;
|
|
122
|
+
/** an end message arrived (or was replayed): every later message is ignored */
|
|
123
|
+
private ended;
|
|
124
|
+
/** the output nodes whose `executed` reached us, so a /history replay never retrieves one twice */
|
|
125
|
+
private heardExecuted;
|
|
126
|
+
/** the run lived through a reconnect and may have lost events: its end reads /history for them */
|
|
127
|
+
private mayHaveMissedEvents;
|
|
128
|
+
private replayUnheardOutputs;
|
|
129
|
+
/** the history entry is written right after the end message is queued, so it may lag by a moment */
|
|
130
|
+
historyRetry: {
|
|
131
|
+
tries: number;
|
|
132
|
+
ms: number;
|
|
133
|
+
};
|
|
134
|
+
/** a run that lived through a reconnect: an output node that ended in the gap is only in /history */
|
|
135
|
+
private retrieveMissedOutputs;
|
|
136
|
+
/** @internal the last event of this run: the watchdog checks only runs quiet for host.runSilenceMs */
|
|
137
|
+
lastHeardAt: number;
|
|
138
|
+
/** @internal a check is in flight: never two at once */
|
|
139
|
+
reconciling: boolean;
|
|
140
|
+
private loggedReconcileProblems;
|
|
141
|
+
private heard;
|
|
142
|
+
private logReconcileOnce;
|
|
143
|
+
/** @internal called before the host reads its queue. After a reconnect the run may have lost events,
|
|
144
|
+
* so its end reads /history for them; the flag is set before any await, so a live end that lands
|
|
145
|
+
* during the reads still looks. A check for silence alone does not set it: a quiet run lost nothing */
|
|
146
|
+
beginReconcile(why: 'reconnect' | 'silence'): void;
|
|
147
|
+
/** @internal ask the host where this run stands. `queued` is the host's queue read BEFORE this
|
|
148
|
+
* history read (the server moves a prompt from one to the other under one lock, so this order never
|
|
149
|
+
* misses a run that ended between the two reads); null when it did not answer, and then the run is
|
|
150
|
+
* never declared lost. A queued run needs no history read. Says how the check ended */
|
|
151
|
+
reconcile: (queued: Set<string> | null) => Promise<'history' | 'waiting' | 'lost'>;
|
|
152
|
+
/** audio retrievals that failed (their files are missing from `audios`) */
|
|
153
|
+
audioErrors: {
|
|
154
|
+
audio: ComfyImageInfo;
|
|
155
|
+
error: unknown;
|
|
156
|
+
}[];
|
|
157
|
+
/** audio files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
158
|
+
audios: ComfyAudioOutput[];
|
|
159
|
+
/** video retrievals that failed (their files are missing from `videos`) */
|
|
160
|
+
videoErrors: {
|
|
161
|
+
video: ComfyImageInfo;
|
|
162
|
+
error: unknown;
|
|
163
|
+
}[];
|
|
164
|
+
/** video files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
165
|
+
videos: ComfyVideoOutput[];
|
|
166
|
+
/** 3D retrievals that failed (their files are missing from `models3d`) */
|
|
167
|
+
models3dErrors: {
|
|
168
|
+
model3d: ComfyImageInfo;
|
|
169
|
+
error: unknown;
|
|
170
|
+
}[];
|
|
171
|
+
/** 3D files retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
172
|
+
models3d: Comfy3DOutput[];
|
|
173
|
+
/** one non-image file through /view, its bytes as the server wrote them; the caller files it */
|
|
174
|
+
private retrieveFile;
|
|
175
|
+
/** image retrievals that failed (their images are missing from `images`);
|
|
176
|
+
* `image` is null for SaveImageWebsocket frames (no server-side file info exists) */
|
|
177
|
+
imageErrors: {
|
|
178
|
+
image: Maybe<ComfyImageInfo>;
|
|
179
|
+
error: unknown;
|
|
180
|
+
}[];
|
|
181
|
+
retrieveImage: (comfyImageInfo: ComfyImageInfo, promptNodeID: ComfyNodeId) => Promise<void>;
|
|
182
|
+
/** re-encode when asked, then write under OUR local naming — never the raw
|
|
183
|
+
* server filename: a cloud host resets its _00001_ counter per run, so the
|
|
184
|
+
* server name overwrote the same local file on every run */
|
|
185
|
+
private encodeAndWrite;
|
|
186
|
+
/** accumulate an output on the prompt; tags from node metadata ride along */
|
|
187
|
+
private pushImage;
|
|
188
|
+
/** the tags an output node was built with (`{ tag }` / `{ tags }` metadata) */
|
|
189
|
+
private tagsOf;
|
|
190
|
+
/** the sent graph saves through SaveImageWebsocket: those outputs exist only as ws frames */
|
|
191
|
+
private get sendsWsFrames();
|
|
192
|
+
/** true while the currently executing node is a SaveImageWebsocket in the
|
|
193
|
+
* SENT snapshot (the ephemeral rewrite only touches the snapshot, so the
|
|
194
|
+
* live graph may still say SaveImage) — binary frames are then OUTPUTS */
|
|
195
|
+
get wsOutputNodeExecuting(): boolean;
|
|
196
|
+
/** @internal a live preview frame of this run; never an output (the host routes ws saver frames
|
|
197
|
+
* to onWsImageOutput before they get here) */
|
|
198
|
+
onPreviewFrame(p: {
|
|
199
|
+
bytes: Uint8Array;
|
|
200
|
+
mime: string;
|
|
201
|
+
metadata: unknown;
|
|
202
|
+
}): void;
|
|
203
|
+
/** one binary ws frame = one output image of the executing SaveImageWebsocket
|
|
204
|
+
* node (architecture.md item 14 — the zero-server-disk path) */
|
|
205
|
+
onWsImageOutput: (p: {
|
|
206
|
+
bytes: Uint8Array;
|
|
207
|
+
mime: string;
|
|
208
|
+
}) => void;
|
|
209
|
+
private storeWsImage;
|
|
210
|
+
/** images retrieved for this execution, in arrival order (final once `done` resolves) */
|
|
211
|
+
images: MediaImage[];
|
|
212
|
+
/** text outputs emitted for this execution, in arrival order (final once `done` resolves) */
|
|
213
|
+
texts: ComfyTextOutput[];
|
|
214
|
+
/** live display text per node WHILE it runs, newest wins (`send_progress_text` is a
|
|
215
|
+
* replacement, not a delta). This is the only channel carrying text DURING a node: a
|
|
216
|
+
* generator that streams its tokens shows up here, and nowhere in the final outputs */
|
|
217
|
+
progressTexts: Map<string, string>;
|
|
218
|
+
/** the node that most recently published live text — what "watch it work" means */
|
|
219
|
+
progressText: string | null;
|
|
220
|
+
/** @internal a live-text frame for one node */
|
|
221
|
+
onProgressText(p: {
|
|
222
|
+
nodeId: string;
|
|
223
|
+
text: string;
|
|
224
|
+
}): void;
|
|
225
|
+
/** the last text output, the one a single-generator workflow means by "the result" */
|
|
226
|
+
get text(): string | null;
|
|
227
|
+
update(data: Partial<ComfyExecutionData>): void;
|
|
228
|
+
private alreadyDone;
|
|
229
|
+
private _finish;
|
|
230
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ComfyExecutionStatus = 'New' | 'Scheduled' | 'Running' | 'Success' | 'Failure';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ComfyExecutionStatus = 'New' | 'Scheduled' | 'Running' | 'Success' | 'Failure';
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { ComfyHost } from '../host/ComfyHost.cjs';
|
|
2
|
+
import type { LiteGraphJSON } from '../litegraph/LiteGraphJSON.cjs';
|
|
3
|
+
import { ComfyNode } from '../graph/ComfyNode.cjs';
|
|
4
|
+
import type { ComfyNodeId, ComfyNodeMetadata } from '../graph/ComfyNodeID.cjs';
|
|
5
|
+
import { ComfyExecution, type ExecutionPreview, type ExecutionProgress } from './ComfyExecution.cjs';
|
|
6
|
+
import { type ComfyOrgApiKeySource } from './comfyOrgApiKey.cjs';
|
|
7
|
+
import type { ComfySchema } from '../sdk-generator/ComfySchema.cjs';
|
|
8
|
+
import type { ComfyApiJson } from '../sdk-generator/comfy-api-json.cjs';
|
|
9
|
+
import { type AbsolutePath, type Maybe, type SaveOptions, type Tagged } from '../types/index.cjs';
|
|
10
|
+
import type { SdkForHost } from '../types/comfy-sdk.cjs';
|
|
11
|
+
import { type WsMsgExecuting, type WsMsgExecutionCached, type WsMsgProgress } from './ComfyWsApi.cjs';
|
|
12
|
+
export type ProgressReport = {
|
|
13
|
+
percent: number;
|
|
14
|
+
isDone: boolean;
|
|
15
|
+
countDone: number;
|
|
16
|
+
countTotal: number;
|
|
17
|
+
};
|
|
18
|
+
export type ComfyNodeIdMode = 'use_stringified_numbers_only' | 'use_class_name_and_number';
|
|
19
|
+
export type RunSettings = {
|
|
20
|
+
/** local disk saving is OPT-IN: unset/false keeps outputs in memory only
|
|
21
|
+
* (`execution.images` buffers); `true` = raw save, an object re-encodes/relocates */
|
|
22
|
+
save?: boolean | SaveOptions;
|
|
23
|
+
/** rewrite every SaveImage node to SaveImageWebsocket in the SENT prompt —
|
|
24
|
+
* outputs never touch the server disk. Implies `scrubHistory` unless that
|
|
25
|
+
* is explicitly false. (architecture.md item 14) */
|
|
26
|
+
ephemeral?: boolean;
|
|
27
|
+
/** delete this run's server history entry (workflow JSON, prompts, filenames)
|
|
28
|
+
* after `done` — loud but non-fatal on failure */
|
|
29
|
+
scrubHistory?: boolean;
|
|
30
|
+
idMode?: ComfyNodeIdMode;
|
|
31
|
+
/** render a live single-line progress report to the console */
|
|
32
|
+
log?: boolean;
|
|
33
|
+
/** called on every progress-relevant websocket message */
|
|
34
|
+
onProgress?: (p: ExecutionProgress) => void;
|
|
35
|
+
/** called on every live preview frame of this run (the image a sampler is forming). Opt in:
|
|
36
|
+
* without it no frame is decoded for the run. ComfyUI sends frames only when launched with
|
|
37
|
+
* `--preview-method`, see `host.fetchPreviewMethod()` */
|
|
38
|
+
onPreview?: (p: ExecutionPreview) => void;
|
|
39
|
+
/** the Comfy account key for this run's paid partner API nodes; overrides the host's
|
|
40
|
+
* `comfyOrgApiKey`. Sent only when the prompt holds one, never saved */
|
|
41
|
+
comfyOrgApiKey?: ComfyOrgApiKeySource;
|
|
42
|
+
};
|
|
43
|
+
/** exactly what was sent to the host for one execution, frozen at send time */
|
|
44
|
+
export type ExecutionSnapshot = {
|
|
45
|
+
apiJson: ComfyApiJson;
|
|
46
|
+
workflowJson: LiteGraphJSON;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* ComfyWorkflowL
|
|
50
|
+
* - holds the nodes
|
|
51
|
+
* - can be instanciated in both extension and webview
|
|
52
|
+
* - so no link to workspace or run
|
|
53
|
+
*/
|
|
54
|
+
export type ComfyWorkflow_metadata = {
|
|
55
|
+
[key: ComfyNodeId]: ComfyNodeMetadata;
|
|
56
|
+
};
|
|
57
|
+
export type ComfyWorkflowID = Tagged<string, {
|
|
58
|
+
ComfyWorkflowID: true;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const asComfyWorkflowID: (x: string) => ComfyWorkflowID;
|
|
61
|
+
export type ComfyWorkflowData = {
|
|
62
|
+
id?: Maybe<ComfyWorkflowID>;
|
|
63
|
+
apiJson?: ComfyApiJson;
|
|
64
|
+
metadata: ComfyWorkflow_metadata;
|
|
65
|
+
};
|
|
66
|
+
export declare class ComfyWorkflow<ID extends string = string> {
|
|
67
|
+
host: ComfyHost<ID>;
|
|
68
|
+
data: ComfyWorkflowData;
|
|
69
|
+
id: ComfyWorkflowID;
|
|
70
|
+
apiJson: ComfyApiJson;
|
|
71
|
+
outputFolder: AbsolutePath;
|
|
72
|
+
constructor(host: ComfyHost<ID>, data: ComfyWorkflowData);
|
|
73
|
+
/** a dry build: media loads name the local file by its hash and upload nothing, so a graph
|
|
74
|
+
* can be built only to be read (serve derives workflow tags this way) */
|
|
75
|
+
dry: boolean;
|
|
76
|
+
/** nodes, in creation order */
|
|
77
|
+
nodes: ComfyNode[];
|
|
78
|
+
/** @internal every node constructor must call this */
|
|
79
|
+
registerNode: (node: ComfyNode) => void;
|
|
80
|
+
/** number of node in the graph */
|
|
81
|
+
get size(): number;
|
|
82
|
+
setMetadata: (nodeID: ComfyNodeId, meta: ComfyNodeMetadata) => void;
|
|
83
|
+
getMetadata: (nodeID: ComfyNodeId) => Maybe<ComfyNodeMetadata>;
|
|
84
|
+
/** problem accumulator */
|
|
85
|
+
problems: {
|
|
86
|
+
title: string;
|
|
87
|
+
data?: unknown;
|
|
88
|
+
}[];
|
|
89
|
+
recordProblem: (title: string, data?: unknown) => void;
|
|
90
|
+
/** workflow builder, typed from the generated per-host sdk when one is in scope */
|
|
91
|
+
private _builder;
|
|
92
|
+
get builder(): SdkForHost<ID>['Builder'];
|
|
93
|
+
/** base (untyped) view of the same builder, for generic library code */
|
|
94
|
+
get builderBase(): Comfy.Builder;
|
|
95
|
+
onUpdate: (prev: Maybe<ComfyWorkflowData>, next: ComfyWorkflowData) => void;
|
|
96
|
+
/** proxy to this.db.schema */
|
|
97
|
+
get schema(): ComfySchema;
|
|
98
|
+
/** nodes that are still pending execution */
|
|
99
|
+
get pendingNodes(): ComfyNode[];
|
|
100
|
+
get nodesByUpdatedAt(): ComfyNode[];
|
|
101
|
+
/** nodes, indexed by nodeID */
|
|
102
|
+
nodesIndex: Map<string, ComfyNode<object, object>>;
|
|
103
|
+
/** convert to mermaid DSL expression for nice graph rendering */
|
|
104
|
+
toMermaid: (DIR?: 'LR' | 'TD') => string;
|
|
105
|
+
/** export the graph in ComfyUI's saved-workflow format (autolayouted by default) */
|
|
106
|
+
toWorkflowJson: (p?: {
|
|
107
|
+
layout?: boolean;
|
|
108
|
+
}) => Promise<LiteGraphJSON>;
|
|
109
|
+
/** export the graph in ComfyUI's api format (what POST /prompt takes) */
|
|
110
|
+
toApiJson: (ns?: ComfyNodeIdMode) => ComfyApiJson;
|
|
111
|
+
/** @internal pointer to the currently executing node */
|
|
112
|
+
currentExecutingNode: ComfyNode | null;
|
|
113
|
+
get progressCurrentNode(): Maybe<ProgressReport>;
|
|
114
|
+
get progressGlobal(): ProgressReport;
|
|
115
|
+
/** @internal update the progress value of the currently focused onde */
|
|
116
|
+
onProgress: (msg: WsMsgProgress) => void;
|
|
117
|
+
getTargetWorkflowFilePath: () => AbsolutePath;
|
|
118
|
+
getTargetPromptFilePath: () => AbsolutePath;
|
|
119
|
+
get cacheFolderPath(): AbsolutePath;
|
|
120
|
+
done: boolean;
|
|
121
|
+
/** @internal update pointer to the currently executing node */
|
|
122
|
+
onExecuting: (msg: WsMsgExecuting) => void;
|
|
123
|
+
onExecutionCached: (msg: WsMsgExecutionCached) => void;
|
|
124
|
+
_uidNumber: number;
|
|
125
|
+
getNodeOrCrash: (nodeID: ComfyNodeId) => ComfyNode;
|
|
126
|
+
getNode: (nodeID: ComfyNodeId) => Maybe<ComfyNode>;
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
/** compute autolayout **/
|
|
130
|
+
autoLayout: (p?: {
|
|
131
|
+
node_vsep?: number;
|
|
132
|
+
node_hsep?: number;
|
|
133
|
+
forceLeft?: boolean;
|
|
134
|
+
} | undefined) => ComfyWorkflow<string>;
|
|
135
|
+
/** send the workflow and wait for it to finish (with all outputs downloaded) */
|
|
136
|
+
run: (p?: RunSettings) => Promise<ComfyExecution>;
|
|
137
|
+
/** reset per-run node state so the same workflow can run again cleanly */
|
|
138
|
+
private resetRunState;
|
|
139
|
+
/** send the workflow; returns the live execution (await `execution.done` yourself) */
|
|
140
|
+
start: (p?: RunSettings) => Promise<ComfyExecution>;
|
|
141
|
+
}
|