comfy-ts 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +363 -0
  3. package/dist/cli.js +764 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/index.cjs +4128 -0
  6. package/dist/index.cjs.map +1 -0
  7. package/dist/index.d.cts +9862 -0
  8. package/dist/index.d.ts +9846 -58
  9. package/dist/index.js +4049 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/log-CdfgILde.js +10 -0
  12. package/dist/log-CdfgILde.js.map +1 -0
  13. package/dist/run-tui-Io8Xea0L.js +3340 -0
  14. package/dist/run-tui-Io8Xea0L.js.map +1 -0
  15. package/package.json +104 -75
  16. package/src/cli/comfy-ts-cli.ts +36 -0
  17. package/src/cli/gen.ts +47 -0
  18. package/src/cli/outline.ts +82 -0
  19. package/src/cli/tui/components/DraftsOverlay.tsx +44 -0
  20. package/src/cli/tui/components/EditField.tsx +27 -0
  21. package/src/cli/tui/components/Header.tsx +51 -0
  22. package/src/cli/tui/components/HostPanel.tsx +37 -0
  23. package/src/cli/tui/components/LorasOverlay.tsx +49 -0
  24. package/src/cli/tui/components/OverlayList.tsx +25 -0
  25. package/src/cli/tui/components/PickerOverlays.tsx +66 -0
  26. package/src/cli/tui/components/PreviewPanel.tsx +33 -0
  27. package/src/cli/tui/components/PromptOverlay.tsx +16 -0
  28. package/src/cli/tui/components/StatusBar.tsx +165 -0
  29. package/src/cli/tui/components/TextOverlay.tsx +72 -0
  30. package/src/cli/tui/components/TreePanel.tsx +51 -0
  31. package/src/cli/tui/components/TuiApp.tsx +223 -0
  32. package/src/cli/tui/components/VarsPanel.tsx +86 -0
  33. package/src/cli/tui/findDefinedWorkflow.ts +16 -0
  34. package/src/cli/tui/keys.ts +20 -0
  35. package/src/cli/tui/protocolImagePainter.ts +59 -0
  36. package/src/cli/tui/run-tui.tsx +73 -0
  37. package/src/cli/tui/state/DraftsSt.ts +273 -0
  38. package/src/cli/tui/state/EditorSt.ts +289 -0
  39. package/src/cli/tui/state/ExecSt.ts +170 -0
  40. package/src/cli/tui/state/HostSt.ts +107 -0
  41. package/src/cli/tui/state/LorasSt.ts +185 -0
  42. package/src/cli/tui/state/PickerSt.ts +112 -0
  43. package/src/cli/tui/state/PreviewSt.ts +138 -0
  44. package/src/cli/tui/state/QueueSt.ts +59 -0
  45. package/src/cli/tui/state/SettingsSt.ts +73 -0
  46. package/src/cli/tui/state/TreeSt.ts +122 -0
  47. package/src/cli/tui/state/TuiSt.ts +169 -0
  48. package/src/cli/tui/state/WorkflowsSt.ts +92 -0
  49. package/src/cli/tui-env.ts +8 -0
  50. package/src/errors/InvalidPromptError.ts +12 -0
  51. package/src/graph/ComfyNode.ts +403 -0
  52. package/src/graph/ComfyNodeID.ts +28 -0
  53. package/src/graph/ComfyNodeOutput.ts +16 -0
  54. package/src/graph/NodeSlotSize.ts +4 -0
  55. package/src/graph/autoValue.ts +17 -0
  56. package/src/host/ComfyHost.ts +646 -0
  57. package/src/host/ComfyInstallType.ts +15 -0
  58. package/src/host/ComfyManager.ts +232 -0
  59. package/src/host/ComfyUploader.ts +110 -0
  60. package/src/host/ComfyWorkflowBuilder.ts +60 -0
  61. package/src/host/Requirements.ts +55 -0
  62. package/src/host/ResilientWebsocket.ts +147 -0
  63. package/src/host/loraManagerApi.ts +98 -0
  64. package/src/image-utils/_getPngMetadata.ts +53 -0
  65. package/src/image-utils/_getWebpMetadata.ts +38 -0
  66. package/src/image-utils/_parseExifData.ts +53 -0
  67. package/src/index.ts +89 -0
  68. package/src/litegraph/LiteGraphGroup.ts +22 -0
  69. package/src/litegraph/LiteGraphJSON.ts +46 -0
  70. package/src/litegraph/LiteGraphLink.ts +23 -0
  71. package/src/litegraph/LiteGraphLinkID.ts +6 -0
  72. package/src/litegraph/LiteGraphNode.ts +69 -0
  73. package/src/litegraph/LiteGraphNodeInput.ts +27 -0
  74. package/src/litegraph/LiteGraphNodeOutput.ts +23 -0
  75. package/src/litegraph/LiteGraphSlotIndex.ts +6 -0
  76. package/src/litegraph/convertFlowToLiteGraphJSON.ts +114 -0
  77. package/src/manager/ComfyRegistry.ts +124 -0
  78. package/src/manager/generated/KnownComfyCustomNodeName.ts +19280 -0
  79. package/src/manager/generated/KnownComfyPluginTitle.ts +5130 -0
  80. package/src/manager/generated/KnownComfyPluginURL.ts +2589 -0
  81. package/src/manager/generated/KnownModel_Base.ts +126 -0
  82. package/src/manager/generated/KnownModel_FileName.ts +2287 -0
  83. package/src/manager/generated/KnownModel_Name.ts +2287 -0
  84. package/src/manager/generated/KnownModel_SavePath.ts +263 -0
  85. package/src/manager/generated/KnownModel_Type.ts +97 -0
  86. package/src/manager/json/alter-list.json +224 -0
  87. package/src/manager/json/custom-node-list.extra.ts +13 -0
  88. package/src/manager/json/custom-node-list.json +21948 -0
  89. package/src/manager/json/extension-node-map.json +31282 -0
  90. package/src/manager/json/github-stats.json +12602 -0
  91. package/src/manager/json/model-list.extra.ts +26 -0
  92. package/src/manager/json/model-list.json +5052 -0
  93. package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +56 -0
  94. package/src/manager/loaders/step2_custom-node-list-loader.ts +149 -0
  95. package/src/manager/loaders/step3_extension-node-map-loader.ts +189 -0
  96. package/src/manager/loaders/step4_model-list-loader.ts +159 -0
  97. package/src/manager/script-update-manager.bun.ts +18 -0
  98. package/src/manager/types/ComfyManagerAPIFetchPolicy.ts +9 -0
  99. package/src/manager/types/ComfyManagerAPIModelList.ts +10 -0
  100. package/src/manager/types/ComfyManagerAPIPluginList.ts +11 -0
  101. package/src/manager/types/ComfyManagerFileModelInfo.ts +5 -0
  102. package/src/manager/types/ComfyManagerFilePluginContent.ts +13 -0
  103. package/src/manager/types/ComfyManagerFilePluginList.ts +5 -0
  104. package/src/manager/types/ComfyManagerModelInfo.ts +18 -0
  105. package/src/manager/types/ComfyManagerPluginContentMetadata.ts +16 -0
  106. package/src/manager/types/ComfyManagerPluginEnums.ts +8 -0
  107. package/src/manager/types/ComfyManagerPluginInfo.ts +50 -0
  108. package/src/runner/ComfyExecution.ts +301 -0
  109. package/src/runner/ComfyExecutionStatus.ts +2 -0
  110. package/src/runner/ComfyWorkflow.ts +395 -0
  111. package/src/runner/ComfyWorkflowLayout.ts +96 -0
  112. package/src/runner/ComfyWsApi.ts +159 -0
  113. package/src/runner/MediaImage.ts +262 -0
  114. package/src/sdk-generator/ComfyNodeSchema.ts +79 -0
  115. package/src/sdk-generator/ComfySchema.ts +369 -0
  116. package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +95 -0
  117. package/src/sdk-generator/Primitives.ts +76 -0
  118. package/src/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.ts +39 -0
  119. package/src/sdk-generator/_pythonModuleToNamespace.ts +27 -0
  120. package/src/sdk-generator/_toQualifiedNodeKey.ts +5 -0
  121. package/src/sdk-generator/comfy-api-json.ts +16 -0
  122. package/src/sdk-generator/comfyui-sdk-codegen.ts +287 -0
  123. package/src/sdk-generator/comfyui-types.ts +56 -0
  124. package/src/sdk-generator/litegraphToApiRequestPayload.ts +157 -0
  125. package/src/ssh-host-manager/ssh-config-manager.ts +89 -0
  126. package/src/ssh-host-manager/ssh-config.windows.md +32 -0
  127. package/src/ssh-host-manager/ssh-manager.ts +129 -0
  128. package/src/state.ts +136 -0
  129. package/src/types/comfy-sdk.ts +106 -0
  130. package/src/types/index.ts +55 -0
  131. package/src/utils/CodeBuffer.ts +61 -0
  132. package/src/utils/ComfyColors.ts +38 -0
  133. package/src/utils/ansi.ts +26 -0
  134. package/src/utils/ansiImage.ts +36 -0
  135. package/src/utils/bang.ts +39 -0
  136. package/src/utils/deepCopyNaive.ts +1 -0
  137. package/src/utils/downloadFile.ts +77 -0
  138. package/src/utils/escapeJSKey.ts +32 -0
  139. package/src/utils/exhaust.ts +4 -0
  140. package/src/utils/extractErrorMessage.ts +11 -0
  141. package/src/utils/fuzzyMatch.ts +8 -0
  142. package/src/utils/githubRegexes.ts +2 -0
  143. package/src/utils/hashArrayBuffer.ts +6 -0
  144. package/src/utils/log.ts +9 -0
  145. package/src/utils/loraTag.ts +10 -0
  146. package/src/utils/printArkResultInConsole.ts +16 -0
  147. package/src/utils/softValidate.ts +8 -0
  148. package/src/utils/stringifyReadable.ts +32 -0
  149. package/src/utils/toposort.ts +59 -0
  150. package/src/utils/tryExtracting.ts +41 -0
  151. package/src/utils/writeFile.ts +16 -0
  152. package/src/vars/ComfyVars.ts +531 -0
  153. package/src/vars/DefinedWorkflow.ts +112 -0
  154. package/src/vars/loraKeywords.ts +56 -0
  155. package/dist/index.d.mts +0 -74
  156. package/dist/index.mjs +0 -3
  157. package/dist/index.mjs.map +0 -1
  158. package/readme.md +0 -40
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.ts","../src/sdk-generator/_pythonModuleToNamespace.ts","../src/sdk-generator/_toQualifiedNodeKey.ts","../src/utils/CodeBuffer.ts","../src/utils/escapeJSKey.ts","../src/sdk-generator/Primitives.ts","../src/sdk-generator/ComfyNodeSchema.ts","../src/sdk-generator/comfyui-sdk-codegen.ts","../src/sdk-generator/comfyui-types.ts","../src/sdk-generator/ComfySchema.ts","../src/utils/stringifyReadable.ts","../src/cli/gen.ts","../src/cli/outline.ts","../src/cli/comfy-ts-cli.ts"],"sourcesContent":["/** having a bunch of sensible default will help slightly */\nexport function getUnionNameBasedOnFirstFoundEnumName(\n //\n enumName: string,\n hash: string,\n hashContent: string,\n): string {\n // core enums\n if (enumName === 'KSampler.sampler_name') return 'E_SamplerName'\n if (enumName === 'KSampler.scheduler') return 'E_SchedulerName'\n if (enumName === 'CheckpointLoaderSimple.ckpt_name') return 'E_CkptName'\n if (enumName === 'VAELoader.vae_name') return 'E_VaeName'\n if (enumName === 'LoraLoader.lora_name') return 'E_LoraName'\n // upscape methods\n if (enumName === 'LatentUpscale.upscale_method') return 'E_LatentUpscaleMethod'\n if (enumName === 'ImageScale.upscale_method') return 'E_ImageUpscaleMethod'\n // core objects\n if (enumName === 'LoadImage.image') return 'E_Image'\n if (enumName === 'LoadImageMask.channel') return 'E_Channel'\n // misc\n if (enumName === 'KSamplerAdvanced.add_noise') return 'E_EnableOrDisable'\n if (enumName === 'LatentRotate.rotation') return 'E_Rotation'\n if (enumName === 'LatentFlip.flip_method') return 'E_FlipMethod'\n if (enumName === 'CLIPLoader.type') return 'E_ClipType'\n if (enumName === 'UNETLoader.weight_dtype') return 'E_WeightDType'\n if (enumName === 'DualCLIPLoader.type') return 'E_DualClipType'\n if (enumName === 'CheckpointLoader.config_name') return 'E_CkptConfigName'\n\n // civitai_comfy_nodes\n if (enumName === 'civitai_comfy_nodes.CivitAI_Checkpoint_Loader.ckpt_name') return 'E_CivitAICkptName'\n\n // Impact-Specific\n if (enumName === 'Impact-Pack.SAMDetectorCombined.detection_hint') return 'E_ImpactDetectionHint'\n\n // Misc\n if (hashContent === 'false|true') return 'E_TrueOrFalse'\n if (hashContent === 'CPU|GPU') return 'E_CpuOrGpu'\n return 'E_' + hash\n}\n","export function pythonModuleToPrefix(pythonModule: string): string {\n // if (pythonModule == null) console.error(`[🔴🔴🔴🔴🔴🔴] `, pythonModule)\n if (pythonModule === 'nodes') return ''\n if (pythonModule.startsWith('comfy_extras.')) return '' //''\n if (pythonModule.startsWith('comfy_api_nodes.')) return pythonModule.replace('comfy_api_nodes.', 'api.')\n if (pythonModule.startsWith('custom_nodes.')) {\n // return `${pythonModuleToNamespace_(pythonModule.replace('custom_nodes.', ''))}.`\n return (\n pythonModule //\n // remove always present \"custom_nodes.\" prefix\n .replace(/^custom_nodes\\./i, '')\n // remove common ~comfyui prefixes and suffixes\n .replace(/^comfyui[-_]/i, '')\n .replace(/[-_]comfyui$/i, '')\n // remove common ~comfy prefixes and suffixes\n .replace(/^comfy[-_]/i, '')\n .replace(/[-_]comfy$/i, '')\n // remove common ~nodes prefixes and suffixes\n .replace(/^nodes[-_]/i, '')\n .replace(/[-_]node[-_]suite$/i, '') + '.'\n )\n }\n // unknown module layout: fall back to a sanitized module prefix instead of\n // crashing the whole codegen because of one unusual custom node\n console.warn(`[comfy-ts] unexpected pythonModule \"${pythonModule}\", using it as prefix as-is`)\n return `${pythonModule}.`\n}\n","import { pythonModuleToPrefix } from 'src/sdk-generator/_pythonModuleToNamespace.ts'\n\nexport const toQualifiedNodeKey = (pythonModule: string, nameInComfy: string): string => {\n return `${pythonModuleToPrefix(pythonModule)}${nameInComfy}`\n}\n","/** this class is used to buffer text and then write it to a file */\nexport class CodeBuffer {\n public tab: string = ' '\n constructor(\n private _indent: number = 0,\n lines: string[] = [],\n ) {\n for (const line of lines) this.writeLine(line)\n }\n\n content: string = ''\n\n // #region adding text\n newLine = (): string => (this.content += '\\n')\n line = (...txts: string[]): this => this.writeLine(txts.join(''))\n append = (str: string): string => (this.content += str)\n writeLine = (txt: string): this => {\n this.content +=\n txt\n .split('\\n')\n .map((line) => repeatStr(this._indent, this.tab) + line)\n .join('\\n') + '\\n'\n return this\n }\n w = (txt: string, opts: { if: boolean } = { if: true }): void => {\n if (opts.if) this.writeLine(txt)\n }\n\n // #region indentations\n indent = (): number => this._indent++\n deindent = (): number => this._indent--\n indented = (fn: () => void): void => {\n this._indent++\n fn()\n this._indent--\n }\n\n bar = (text: string): void => this.w(renderBar(text, '// '))\n\n // writeTS = (path: string) => {\n // // const prefix = `// FILE GENERATED: do not edit. Changes made manually will be overwritten.\\n\\n`\n // // const outPretty = prefix + prettify(this.content)\n // const outPretty = prettify(this.content)\n // writeFileSync(path, outPretty, 'utf-8')\n // }\n}\n\nexport const repeatStr = (x: number, str: string): string => {\n let out = ''\n for (let i = 0; i < x; i++) out += str\n return out\n}\n\nexport const renderBar = (text: string, prefix: string = ''): string => {\n const ___bar___ = '============================================================================='\n return (\n `${prefix}|${___bar___}|\\n` +\n `${prefix}| ${text} ${repeatStr(___bar___.length - text.length - 4, ' ')} |\\n` +\n `${prefix}|${___bar___}|`\n )\n}\n","const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/\n\nconst isValidJSKey = (s: string): boolean => {\n return regex.test(s)\n}\n\nexport const escapeJSKey = (s: string): string => {\n if (typeof s !== 'string') {\n return 'string'\n // console.log(s)\n // debugger\n }\n // ❌ probably wrong\n if (!isValidJSKey(s)) {\n // debugger\n return `\"${s}\"`\n }\n return s\n}\n\nexport const asJSAccessor = (s: string): string => {\n if (typeof s !== 'string') {\n return 'string'\n // console.log(s)\n // debugger\n }\n if (!isValidJSKey(s)) {\n // debugger\n return `[\"${s}\"]`\n }\n return `.${s}`\n}\n","import type { LiteGraphNode } from 'src/litegraph/LiteGraphNode.ts'\nimport type { ComfyNodeSchemaJSON } from 'src/sdk-generator/ComfyUIObjectInfoTypes.ts'\nimport type { NodeInputExt } from 'src/sdk-generator/comfyui-types.ts'\n\nexport const ComfyPrimitiveMapping: { [key: string]: string } = {\n // BACK\n BOOLEAN: 'boolean',\n FLOAT: 'number',\n INT: 'number',\n STRING: 'string',\n\n // ????\n // ⏸️ Boolean: 'boolean',\n // ⏸️ Float: 'number',\n // ⏸️ Integer: 'number',\n // ⏸️ SchedulerName: 'string',\n // ⏸️ SamplerName: 'string',\n // ⏸️ IMAGE_PATH: 'string',\n}\n\nexport const ComfyPrimitives: string[] = Object.keys(ComfyPrimitiveMapping)\n\n/**\n * when a litegraph node has no input for a given ComfyUI node input\n * (e.g. a seed or an enum that has not been turned into a primitive)\n */\nexport const howManyWidgetValuesForThisSchemaType = (input: NodeInputExt): number => {\n if (input.typeName === 'INT') {\n if (input.nameInComfy === 'seed' || input.nameInComfy === 'noise_seed') return 2\n }\n if (input.isPrimitive) return 1\n // 🔴\n if (input.typeName.startsWith('E_')) return 1\n // console.log(343, input)\n return 0\n}\n\n/**\n * then a litegraph node has an input entry, some convoluted logic seems to be necessary\n * to determine how many Field_values need to be consumed for this input\n */\nexport const howManyWidgetValuesForThisInputType = (type: string, nameInComfy: string): number => {\n if (type === 'INT') {\n if (nameInComfy === 'seed' || nameInComfy === 'noise_seed') return 2\n return 1\n }\n if (type === 'BOOLEAN') return 1\n if (type === 'FLOAT') return 1\n if (type === 'STRING') return 1\n if (type === 'COMBO') return 1\n if (type === 'INT:seed') return 2\n if (type === 'INT:noise_seed') return 2\n\n // not a primitive, no Field_values\n return 0\n}\nexport const ComfyDefaultNodeWhenUnknown_Name: string = 'UnknownNodeXX'\n\nexport const ComfyDefaultNodeWhenUnknown_Schema: ComfyNodeSchemaJSON = {\n category: 'test',\n input: {},\n output: [],\n description: 'This is a test node',\n output_name: [],\n display_name: 'UnknownNodeXX',\n name: 'UnknownNodeXX',\n output_is_list: [],\n output_node: false,\n python_module: 'nodes',\n}\n\nexport class UnknownCustomNode extends Error {\n constructor(public node: LiteGraphNode) {\n super(`❌ node ${node.id}(${node.type}) has no known schema; you probably need to install some custom node`)\n }\n}\n","import type { Maybe } from 'src/types/index.ts'\nimport { CodeBuffer } from 'src/utils/CodeBuffer.ts'\nimport { escapeJSKey } from 'src/utils/escapeJSKey.ts'\nimport type { ComfyInputOpts, ComfyNodeSchemaJSON } from 'src/sdk-generator/ComfyUIObjectInfoTypes.ts'\nimport type { ComfyUnionInfo, NodeInputExt, NodeOutputExt } from 'src/sdk-generator/comfyui-types.ts'\nimport { ComfyPrimitiveMapping } from 'src/sdk-generator/Primitives.ts'\n\nexport type NodeOwnEnum = {\n in: 'input' | 'output'\n ownName: string\n enum: ComfyUnionInfo\n}\n\nexport class ComfyNodeSchema {\n /** list of types the node has a single output of */\n _singleOutputs: Maybe<NodeOutputExt[]> = null\n\n get singleOutputs(): NodeOutputExt[] {\n if (this._singleOutputs != null) return this._singleOutputs\n const x: { [key: string]: number } = {}\n for (const i of this.outputs) x[i.typeName] = (x[i.typeName] ?? 0) + 1\n this._singleOutputs = this.outputs.filter((i) => x[i.typeName] === 1)\n return this._singleOutputs\n }\n\n constructor(\n public raw: ComfyNodeSchemaJSON,\n public nameInComfy: string,\n public nodeKey: string, // same but qualified to keep track of pythonNamespace\n public category: string,\n public inputs: NodeInputExt[],\n public outputs: NodeOutputExt[],\n public pythonModule: string,\n ) {\n this.category = this.category.replaceAll('/', '_')\n }\n\n codegenUI(): string {\n const b = new CodeBuffer()\n const p = b.w\n p(` ${escapeJSKey(this.nodeKey)}: {`)\n this.inputs.forEach((i, _ix) => {\n // 1/3\n if (i.isPrimitive) {\n const tsType = ComfyPrimitiveMapping[i.typeName]\n if (tsType == null) return console.log(`[🔶] invariant violation`)\n p(` ${escapeJSKey(i.nameInComfy)}: { kind: '${tsType}', type: ${tsType} }`)\n }\n // 2/3\n else if (i.isEnum) {\n p(` ${escapeJSKey(i.nameInComfy)}: { kind: 'enum', type: Union['${i.typeName}'] }`)\n // p(` ${escapeJSKey(i.nameInComfy)}: { kind: 'enum', type: '${this.nodeKey}.${i.nameInComfy}' }`) // prettier-ignore\n }\n // 3/3\n else {\n p(` // ${escapeJSKey(i.nameInComfy)}: { kind: 'object', type: ${i.typeName} }`)\n }\n })\n p(` }`)\n return b.content\n }\n\n renderOpts(opts?: ComfyInputOpts): Maybe<string> {\n if (opts == null) return null\n if (typeof opts === 'string') return null\n let out = '/**'\n if (opts.default != null) out += ` default=${JSON.stringify(opts.default)}`\n if (opts.min != null) out += ` min=${JSON.stringify(opts.min)}`\n if (opts.max != null) out += ` max=${JSON.stringify(opts.max)}`\n if (opts.step != null) out += ` step=${JSON.stringify(opts.step)}`\n out += ' */'\n return out\n }\n}\n\nexport const wrapQuote = (s: string): string => {\n if (s.includes(\"'\")) return `\"${s}\"`\n return `'${s}'`\n}\n","import type { Maybe } from 'src/types/index.ts'\nimport { CodeBuffer } from 'src/utils/CodeBuffer.ts'\nimport { escapeJSKey } from 'src/utils/escapeJSKey.ts'\nimport type { ComfySchema } from 'src/sdk-generator/ComfySchema.ts'\n\nimport { type ComfyNodeSchema, wrapQuote } from 'src/sdk-generator/ComfyNodeSchema.ts'\n\n/**\n * convert a host id to the namespace name it gets inside the global `Comfy` namespace\n * e.g. 'windows-1' -> 'Windows1', 'my_cloud.instance' -> 'MyCloudInstance'\n */\nexport function hostIdToNamespace(hostId: string): string {\n const parts = hostId.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n const ns = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join('')\n if (ns.length === 0) throw new Error(`cannot derive a namespace from host id \"${hostId}\"`)\n // namespaces can't start with a digit\n return /^[0-9]/.test(ns) ? `Host${ns}` : ns\n}\n\nexport type CodegenOptions = {\n /** host id; drives both the `Comfy.Hosts` registry key and the namespace name */\n hostId: string\n /** module to import runtime-facing types from (default: 'comfy-ts') */\n packageName?: string\n}\n\n/**\n * emit the typed SDK for one host:\n *\n * declare global {\n * namespace Comfy {\n * namespace <HostNs> { IN / OUT / Node / Builder / Slots / Accepts / Union / ... }\n * interface Hosts { '<host-id>': <HostNs>.Sdk }\n * }\n * }\n */\nexport function codegenSDK(this: ComfySchema, opts: CodegenOptions): string {\n const ns = hostIdToNamespace(opts.hostId)\n const packageName = opts.packageName ?? 'comfy-ts'\n const b = new CodeBuffer()\n const p = b.w\n\n p(`/** generated by comfy-ts for host \"${opts.hostId}\" — do not edit */`)\n p(``)\n p(`import type { ComfyNode, ComfyNodeOutput, ComfyNodeMetadata, ComfyNodeSchemaJSON } from '${packageName}'`)\n p(``)\n p(`declare global {`)\n b.indent()\n\n p(`namespace Comfy {`)\n b.indent()\n\n p(`namespace ${ns} {`)\n b.indent()\n\n // #region PythonModules ----------------------------------------------------------------------\n p(`// #${''}region PythonModules`)\n p(`/** list of all python modules installed on this host */`)\n p(`export type PythonModules =`)\n b.indent()\n const pythonModulesArr: [string, string[]][] = Array.from(this.pythonModules.entries()) //\n .toSorted((a, b) => a[0].localeCompare(b[0]))\n for (const [k, v] of pythonModulesArr) {\n p(`/**`)\n p(`* Nodes: ${v.join(', ')}`)\n p(`*/`)\n p(`| ${wrapQuote(k)}`)\n }\n b.deindent()\n p(`// #${''}endregion`)\n\n // #region IN ---------------------------------------------------------------------------------\n const nodes = this.nodes.toSorted((a, b) => a.nodeKey.localeCompare(b.nodeKey))\n p(`interface IN {`)\n b.indent()\n for (const n of nodes) {\n p(`${escapeJSKey(n.nodeKey)}: {`)\n for (const i of n.inputs) {\n const opts_ = typeof i.opts === 'string' ? null : i.opts\n let type = `Accepts[${JSON.stringify(i.typeName)}]`\n // COMBO inputs (ComfyUI ≥ 0.3.x) carry literal choices in opts.options\n const comboOptions =\n i.typeName === 'COMBO' && Array.isArray(opts_?.options)\n ? opts_.options.filter(\n (o): o is string | number | boolean =>\n typeof o === 'string' || typeof o === 'number' || typeof o === 'boolean',\n )\n : []\n if (comboOptions.length > 0) {\n type = `${comboOptions.map((o) => JSON.stringify(o)).join(' | ')} | ${type}`\n }\n // custom text/primitive widget types (placeholder/multiline/default in opts)\n // also accept the raw literal, e.g. AUTOCOMPLETE_TEXT_LORAS is just a string\n else if (opts_ && !i.isPrimitive && !i.isEnum) {\n if (typeof opts_.default === 'string' || opts_.placeholder != null || opts_.multiline != null) {\n type = `string | ${type}`\n } else if (typeof opts_.default === 'number') {\n type = `number | ${type}`\n } else if (typeof opts_.default === 'boolean') {\n type = `boolean | ${type}`\n }\n }\n if (opts_) {\n const rendered = n.renderOpts(opts_)\n if (rendered) p(` ${rendered}`)\n }\n const canBeOmmited = opts_?.default !== undefined || !i.required\n p(` ${i.nameInComfyEscaped}${canBeOmmited ? '?' : ''}: ${type}`)\n }\n p(`},`)\n }\n b.deindent()\n p('}')\n p('')\n\n // #region OUT --------------------------------------------------------------------------------\n p(`interface OUT {`)\n b.indent()\n for (const n of nodes) {\n p(`${escapeJSKey(n.nodeKey)}: {`)\n n.outputs.forEach((i, ix) => {\n p(` ${escapeJSKey(i.outKey)}: ComfyNodeOutput<'${i.typeName}', ${ix}>,`)\n })\n p(`}`)\n }\n b.deindent()\n p('}')\n\n // #region Node -------------------------------------------------------------------------------\n p(`interface Node {`)\n for (const n of nodes) {\n p(\n ` ${escapeJSKey(n.nodeKey)}: ComfyNode<IN[${JSON.stringify(n.nodeKey)}], OUT[${JSON.stringify(n.nodeKey)}]> & {`,\n )\n for (const hassingle of n.singleOutputs) {\n p(` ${escapeJSKey(`_${hassingle.typeName}`)}: ComfyNodeOutput<'${hassingle.typeName}'>`)\n }\n p(` }`)\n }\n p('}')\n\n // #region Builder ----------------------------------------------------------------------------\n p(`interface Builder {`)\n for (const n of nodes) {\n const baseDescription = `displayName=\"${n.raw.display_name}\" category=\"${n.category}\" name=\"${n.nameInComfy}\" output=[${n.outputs.map((o) => o.outKey).join(', ')}]`\n if (n.raw.description) {\n p(` /**`)\n p(\n n.raw.description\n .split('\\n')\n .map((i) => ` * ${i}`)\n .join('\\n'),\n )\n p(` * ${baseDescription}`)\n p(` **/`)\n } else {\n p(` /** ${baseDescription} */`)\n }\n p(\n ` ${escapeJSKey(n.nodeKey)}(p: IN[${JSON.stringify(n.nodeKey)}], meta?: ComfyNodeMetadata): Node[${JSON.stringify(n.nodeKey)}]`,\n )\n }\n p(`}`)\n\n // #region Slots ------------------------------------------------------------------------------\n p(`interface Slots {`)\n for (const e of this.knownUnionByHash.values()) {\n p(' // ' + e.unionName)\n for (const alias of e.enumNames) {\n p(` ${escapeJSKey(alias)}: Union['${e.unionName}']`)\n }\n }\n p(`}`)\n\n // #region Embeddings -------------------------------------------------------------------------\n p(`type Embeddings = ${this.data.embeddings.map((e) => wrapQuote(e)).join(' | ') || '\"\"'}`)\n\n const slotTypes = [...this.knownSlotTypes.values()] //\n .map((comfyType) => ({\n comfyType,\n tsType: this.toTSType(comfyType),\n tsType2: this.toAcceptsType(comfyType),\n }))\n .sort((a, b) => b.tsType.length - a.tsType.length)\n\n // #region Producer ---------------------------------------------------------------------------\n p('')\n p('interface Producer {')\n b.indent()\n for (const tp of slotTypes) {\n const allProducingNodes: Maybe<ComfyNodeSchema[]> = this.nodesByProduction[tp.comfyType]\n if (allProducingNodes) {\n p(`${escapeJSKey(tp.comfyType)}: Pick<Builder, ${allProducingNodes.map((i) => `'${i.nodeKey}'`).join(' | ')}>`)\n } else {\n p(`${escapeJSKey(tp.comfyType)}: {}, // no node can output this type.`)\n }\n }\n b.deindent()\n p('}')\n\n // #region Accepts -----------------------------------------------------------------------------\n p(`interface Accepts {`)\n b.indent()\n // 1/3\n p('// injected bottom type (broken/null input specs land here)')\n p(`INVALID_null: any`)\n\n // 2/3\n p('')\n p('// named slot types: everything an input of that type accepts')\n for (const t of slotTypes) {\n p(\n `${escapeJSKey(t.comfyType)}: ${t.tsType} | HasSingle['${t.comfyType}'] | ((x: Producer['${t.comfyType}']) => Accepts['${t.comfyType}'])`,\n )\n }\n\n // 3/3\n p('')\n p('// enum unions: literal values or an output carrying one')\n for (const t of this.knownUnionByHash.values()) {\n p(`${escapeJSKey(t.unionName)}: Union['${t.unionName}'] | ComfyNodeOutput<'${t.unionName}'>`)\n }\n b.deindent()\n p(`}\\n`)\n\n // #region Union ------------------------------------------------------------------------------\n p('interface Union {')\n for (const e of this.knownUnionByHash.values()) {\n if (e.values.length > 0) {\n p(` // ${JSON.stringify(e.enumNames)}`)\n p(` ${e.unionName}: ${e.values.map((v) => `${JSON.stringify(v)}`).join(' | ')}`)\n } else {\n p(` ${e.unionName}: '🔴' // never`)\n }\n }\n p('}')\n\n // #region HasSingle --------------------------------------------------------------------------\n p(`export interface HasSingle {`)\n for (const t of slotTypes) {\n p(` ${escapeJSKey(t.comfyType)}: { '_${t.comfyType}': ${t.tsType} }`)\n }\n p(`}`)\n\n for (const t of this.enumsAppearingInOutput.values()) {\n p(`export interface HasSingle_${t} { _${t}: Union['${t}'] }`)\n }\n\n // #region Schemas ----------------------------------------------------------------------------\n p(`export type Schemas = { [k in NodeType]: ComfyNodeSchemaJSON }`)\n p(`export type NodeType = ${this.nodes.map((i) => `'${i.nodeKey}'`).join(' | ')}`)\n\n // #region Sdk --------------------------------------------------------------------------------\n p(``)\n p(`/** everything above, packaged for the Comfy.Hosts registry */`)\n p(`interface Sdk {`)\n p(` IN: IN`)\n p(` OUT: OUT`)\n p(` Node: Node`)\n p(` Builder: Builder`)\n p(` Slots: Slots`)\n p(` Accepts: Accepts`)\n p(` Union: Union`)\n p(` Producer: Producer`)\n p(` Embeddings: Embeddings`)\n p(` Schemas: Schemas`)\n p(` NodeType: NodeType`)\n p(`}`)\n\n b.deindent()\n p(`}`) // end namespace <HostNs>\n\n p(``)\n p(`interface Hosts {`)\n p(` ${wrapQuote(opts.hostId)}: ${ns}.Sdk`)\n p(`}`)\n\n b.deindent()\n p('}') // end namespace Comfy\n\n b.deindent()\n p('}') // end declare global\n p(``)\n p(`export {}`)\n\n return b.content\n}\n","import type { Branded } from 'src/types/index.ts'\nimport type { ComfyInputOpts } from 'src/sdk-generator/ComfyUIObjectInfoTypes.ts'\n\nexport type ComfyUnionHash = string // '26c34bf761d4be4554ab944105c5a3c017c99453\nexport type ComfyUnionName = string // 'E_26c34bf761d4be4554ab944105c5a3c017c99453'\nexport type ComfyUnionValue = string | boolean | number\n\nexport type ComfyPythonModule = string\nexport type NodeNameInComfy = string\nexport type QualifiedNodeKey = string\n\n/**\n * the textual name of a slot type (slot = input or output of a node),\n * e.g. 'MODEL', 'IMAGE', 'E_CkptName'.\n * Branded string — internals never depend on the global Comfy namespace\n * (that would break host encapsulation: slot types are per-host).\n */\nexport type ComfyNodeSlotTypeName = Branded<string, { SlotTypeName: true }>\nexport const asComfyNodeSlotTypeName = (x: string): ComfyNodeSlotTypeName => x as ComfyNodeSlotTypeName\n\n/** a fully-qualified slot name, e.g. 'LoadImage.image' or 'KSampler.LATENT.OUT' */\nexport type ComfyNodeSlotName = Branded<string, { SlotName: true }>\nexport const asComfyNodeSlotName = (x: string): ComfyNodeSlotName => x as ComfyNodeSlotName\n\nexport type EmbeddingName = Branded<string, { Embedding: true }>\n\nexport type NodeInputExt = {\n slotName: ComfyNodeSlotName\n nameInComfy: string\n nameInComfyEscaped: string\n typeName: ComfyNodeSlotTypeName\n opts?: ComfyInputOpts\n isPrimitive: boolean\n isEnum: boolean\n required: boolean\n index: number\n}\n\nexport type NodeOutputExt = {\n slotName: ComfyNodeSlotName\n typeName: ComfyNodeSlotTypeName\n outKey: string\n nameInComfy: string\n isPrimitive: boolean\n}\n\nexport type ComfyUnionInfo = {\n hash: ComfyUnionHash\n unionName: ComfyUnionName\n values: ComfyUnionValue[]\n enumNames: ComfyNodeSlotName[]\n}\n\n/** an image file name as known by the host (hash-named upload or existing input) */\nexport type ComfyImageName = Branded<string, { ComfyImageName: true }>\nexport const asComfyImageName = (x: string): ComfyImageName => x as ComfyImageName\n","import crypto from 'node:crypto'\nimport { getUnionNameBasedOnFirstFoundEnumName } from 'src/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.ts'\nimport { toQualifiedNodeKey } from 'src/sdk-generator/_toQualifiedNodeKey.ts'\nimport { ComfyNodeSchema } from 'src/sdk-generator/ComfyNodeSchema.ts'\nimport type { ComfyEnumDef, ComfyNodeSchemaJSON, ComfySchemaJSON } from 'src/sdk-generator/ComfyUIObjectInfoTypes.ts'\nimport { codegenSDK } from 'src/sdk-generator/comfyui-sdk-codegen.ts'\nimport {\n asComfyNodeSlotName,\n asComfyNodeSlotTypeName,\n type ComfyImageName,\n type ComfyNodeSlotName,\n type ComfyNodeSlotTypeName,\n type ComfyPythonModule,\n type ComfyUnionHash,\n type ComfyUnionInfo,\n type ComfyUnionName,\n type ComfyUnionValue,\n type EmbeddingName,\n type NodeInputExt,\n type NodeNameInComfy,\n type NodeOutputExt,\n type QualifiedNodeKey,\n} from 'src/sdk-generator/comfyui-types.ts'\nimport {\n ComfyDefaultNodeWhenUnknown_Name,\n ComfyDefaultNodeWhenUnknown_Schema,\n ComfyPrimitiveMapping,\n ComfyPrimitives,\n} from 'src/sdk-generator/Primitives.ts'\nimport type { Maybe } from 'src/types/index.ts'\nimport { escapeJSKey } from 'src/utils/escapeJSKey.ts'\nimport { logInfo } from 'src/utils/log.ts'\n\nexport type ComfySchemaId = string\n\nexport type ComfySchemaData = {\n spec: ComfySchemaJSON\n embeddings: string[]\n}\n\n/**\n * ONE host's schema: the parsed view of its object_info.json + embeddings.\n * Owns union dedup (by sha1 of values), node indexing, and the per-host\n * sdk codegen (`codegenDTS`).\n */\nexport class ComfySchema {\n codegenDTS = codegenSDK.bind(this)\n\n constructor(public data: ComfySchemaData) {\n this.parse()\n }\n\n update(data: Partial<ComfySchemaData>): void {\n const prev: ComfySchemaData = { spec: this.data.spec, embeddings: this.data.embeddings }\n Object.assign(this.data, data)\n try {\n this.parse()\n this.isInvalid = false\n } catch (error) {\n console.error(`❌ [ComfySchema.update] bad schema — keeping the previous one`, error)\n // roll back: a failed update must not leave half-built indexes in use\n this.data = prev\n try {\n this.parse()\n } catch {\n // previous data unparsable too (first update): indexes stay empty\n }\n this.isInvalid = true\n }\n }\n\n isInvalid: boolean = false\n\n /** number of nodes in the current schema (quick way to check your instance infos) */\n get size(): number {\n return Object.keys(this.data.spec).length\n }\n\n // #region parsed indexes\n knownSlotTypes = new Set<ComfyNodeSlotTypeName>()\n knownUnionBySlotName = new Map<ComfyNodeSlotName, ComfyUnionInfo>()\n knownUnionByHash = new Map<ComfyUnionHash, ComfyUnionInfo>()\n knownUnionByName = new Map<ComfyUnionName, ComfyUnionInfo>()\n nodes: ComfyNodeSchema[] = []\n pythonModuleByNodeKey: Map<QualifiedNodeKey, ComfyPythonModule> = new Map()\n pythonModuleByNodeNameInComfy: Map<NodeNameInComfy, ComfyPythonModule> = new Map()\n nodesByNameInComfy: { [key: NodeNameInComfy]: ComfyNodeSchema } = {}\n nodesByKey: { [key: QualifiedNodeKey]: ComfyNodeSchema } = {}\n nodesByProduction: { [key in ComfyNodeSlotTypeName]?: ComfyNodeSchema[] } = {}\n\n // some nodes output anonymous unions. we need to keep track of them for codegen\n enumsAppearingInOutput = new Set<ComfyNodeSlotTypeName>()\n\n pythonModules = new Map<string, NodeNameInComfy[]>()\n\n // #region parse\n private parse(): void {\n // reset all indexes: parse() re-runs on every update()\n this.knownSlotTypes.clear()\n this.knownUnionBySlotName.clear()\n this.knownUnionByHash.clear()\n this.knownUnionByName.clear()\n this.nodes = []\n this.pythonModuleByNodeKey.clear()\n this.pythonModuleByNodeNameInComfy.clear()\n this.nodesByNameInComfy = {}\n this.nodesByKey = {}\n this.nodesByProduction = {}\n this.enumsAppearingInOutput.clear()\n this.pythonModules.clear()\n\n // skip log for the initial dummy empty data\n if (this.data.embeddings.length > 0 || Object.keys(this.data.spec).length > 0)\n this.log(`parsing ComfyUI object_info.json`)\n\n const entries: [string, ComfyNodeSchemaJSON][] = Object.entries(this.data.spec)\n entries.push([ComfyDefaultNodeWhenUnknown_Name, ComfyDefaultNodeWhenUnknown_Schema])\n\n for (const [KK, VV] of entries) {\n // record python module\n const pythonModule = VV.python_module\n const prev = this.pythonModules.get(pythonModule)\n if (prev == null) this.pythonModules.set(pythonModule, [KK])\n else prev.push(KK)\n\n const nodeNameInComfy = KK\n const nodeDef = VV\n const nodeKey = toQualifiedNodeKey(pythonModule, nodeNameInComfy)\n\n if (typeof nodeDef.output === 'string') {\n console.log(\n `[❌ ERROR] nodeDef ${nodeDef.name} has an invalid output definition: ${JSON.stringify(nodeDef.output)}`,\n )\n nodeDef.output = []\n }\n this.pythonModuleByNodeKey.set(nodeKey, pythonModule)\n this.pythonModuleByNodeNameInComfy.set(nodeNameInComfy, pythonModule)\n\n const inputs: NodeInputExt[] = []\n const outputs: NodeOutputExt[] = []\n const node = new ComfyNodeSchema(VV, nodeNameInComfy, nodeKey, nodeDef.category, inputs, outputs, pythonModule)\n\n // INDEX NODE\n this.nodesByNameInComfy[nodeNameInComfy] = node\n this.nodesByKey[nodeKey] = node\n this.nodes.push(node)\n\n // #region outputs ----------------------------------------------------------------------\n const nameCountDict: { [key: string]: number } = {}\n for (const [ix, slotType] of nodeDef.output.entries()) {\n const rawOutputSlotName =\n nodeDef.output_name[ix] || //\n (typeof slotType === 'string' ? slotType : `input_${ix}`)\n\n const outputNameInComfy = rawOutputSlotName\n const at = (nameCountDict[outputNameInComfy] ??= 0)\n const outKeyValue = at === 0 ? outputNameInComfy : `${outputNameInComfy}_${at}`\n nameCountDict[outputNameInComfy]++\n\n let slotTypeName: ComfyNodeSlotTypeName\n const outputSlotName = asComfyNodeSlotName(`${node.nodeKey}.${outKeyValue}.OUT`)\n\n // 1. Primitive\n if (typeof slotType === 'string') {\n slotTypeName = asComfyNodeSlotTypeName(slotType)\n this.knownSlotTypes.add(slotTypeName)\n }\n // 2. ENUM\n else if (Array.isArray(slotType)) {\n const RESX = this.processSlot({ pythonModule, slotName: outputSlotName, comfyUnionDef: slotType })\n slotTypeName = asComfyNodeSlotTypeName(RESX.unionName)\n this.enumsAppearingInOutput.add(slotTypeName)\n }\n // 3. ????\n else {\n throw new Error(`invalid output ${ix} \"${slotType}\" in node \"${nodeNameInComfy}\"`)\n }\n\n // index production\n const arr = this.nodesByProduction[slotTypeName]\n if (arr == null) this.nodesByProduction[slotTypeName] = [node]\n else arr.push(node)\n\n outputs.push({\n slotName: outputSlotName,\n typeName: slotTypeName,\n nameInComfy: outputNameInComfy,\n outKey: outKeyValue,\n isPrimitive: false,\n })\n }\n\n // #region inputs ----------------------------------------------------------------------\n const optionalInputs = Object.entries(nodeDef.input?.optional ?? {}) //\n .map(([name, spec]) => ({ required: false, name, spec }))\n\n const requiredInputs = Object.entries(nodeDef.input?.required ?? {}) //\n .map(([name, spec]) => ({ required: true, name, spec }))\n // when an input is BOTH required and optional (seen in the wild), keep the optional one\n .filter((i) => optionalInputs.find((oi) => oi.name === i.name) == null)\n const allInputs = [...requiredInputs, ...optionalInputs]\n\n for (const ipt of allInputs) {\n const inputNameInComfy = ipt.name\n const typeDef = ipt.spec\n const slotType = typeDef[0]\n const slotOpts = typeDef[1]\n\n let inputTypeName: ComfyNodeSlotTypeName\n const inputSlotName = asComfyNodeSlotName(`${node.nodeKey}.${inputNameInComfy}`)\n\n // 1/4 broken input (null type)\n if (slotType == null) {\n const RESX = this.processSlot({ pythonModule, slotName: inputSlotName, comfyUnionDef: ['❌'] })\n inputTypeName = asComfyNodeSlotTypeName(RESX.unionName)\n }\n // 2/4 named slot type\n else if (typeof slotType === 'string') {\n inputTypeName = asComfyNodeSlotTypeName(slotType)\n this.knownSlotTypes.add(inputTypeName)\n }\n // 3/4 inline enum\n else if (Array.isArray(slotType)) {\n const RESX = this.processSlot({ pythonModule, slotName: inputSlotName, comfyUnionDef: slotType })\n inputTypeName = asComfyNodeSlotTypeName(RESX.unionName)\n }\n // 4/4\n else {\n throw new Error(\n `invalid schema (${JSON.stringify(slotType)}) for input \"${\n ipt.name\n }\" in node \"${nodeNameInComfy}\" (type: ${typeof slotType}; expected: Array | string)`,\n )\n }\n\n node.inputs.push({\n slotName: inputSlotName,\n required: ipt.required,\n nameInComfy: inputNameInComfy,\n nameInComfyEscaped: escapeJSKey(inputNameInComfy),\n typeName: inputTypeName,\n opts: slotOpts,\n isPrimitive: ComfyPrimitives.includes(inputTypeName),\n isEnum: this.knownUnionByName.has(inputTypeName),\n index: node.inputs.length,\n })\n }\n }\n }\n\n // #region processSlot\n processSlot = (p: {\n pythonModule: string\n slotName: ComfyNodeSlotName\n comfyUnionDef: ComfyEnumDef\n }): ComfyUnionInfo => {\n // 1. build enum\n const enumValues: ComfyUnionValue[] = []\n for (const enumValue of p.comfyUnionDef) {\n if (typeof enumValue === 'string') enumValues.push(enumValue)\n else if (typeof enumValue === 'boolean') enumValues.push(enumValue)\n else if (typeof enumValue === 'number') enumValues.push(enumValue)\n else enumValues.push(enumValue.content)\n }\n // 2. hash its value\n const hashContent =\n enumValues.length === 0 //\n ? `[[empty]]`\n : enumValues.sort().join('|')\n const hash = crypto.createHash('sha1').update(hashContent).digest('hex').slice(0, 8)\n\n // 3. retrieve or create an EnumInfo\n let unionInfo: Maybe<ComfyUnionInfo> = this.knownUnionByHash.get(hash)\n if (unionInfo == null) {\n const unionName = getUnionNameBasedOnFirstFoundEnumName(p.slotName, hash, hashContent)\n unionInfo = { hash, unionName, values: enumValues, enumNames: [] }\n this.knownUnionByHash.set(hash, unionInfo)\n this.knownUnionByName.set(unionName, unionInfo)\n }\n unionInfo.enumNames.push(p.slotName)\n\n // 4. store enum by name\n this.knownUnionBySlotName.set(p.slotName, unionInfo)\n return unionInfo\n }\n\n private log(...args: unknown[]): void {\n logInfo(`[👅]: ${args.join(' ')}`)\n }\n\n toTSType(t: string): string {\n // '*' is ComfyUI's wildcard: any output or primitive fits\n if (t === '*') return `string | number | boolean | ComfyNodeOutput<string, number>`\n return ComfyPrimitiveMapping[t]\n ? `${ComfyPrimitiveMapping[t]} | ComfyNodeOutput<'${t}'>`\n : `ComfyNodeOutput<'${t}'>`\n }\n\n toAcceptsType(t: string): string {\n return `ComfyNodeOutput<'${t}'>`\n }\n\n // #region discovery helpers\n /**\n * every possible value for a given slot, straight from the live schema.\n * e.g. schema.values('LoraLoader.lora_name') -> all loras on this host\n */\n values(slotName: string): ComfyUnionValue[] {\n return this.knownUnionBySlotName.get(asComfyNodeSlotName(slotName))?.values ?? []\n }\n\n /** string values only (most enums are), for quick discovery */\n stringValues(slotName: string): string[] {\n return this.values(slotName).filter((v): v is string => typeof v === 'string')\n }\n\n /**\n * for now, simply ensure that the number of parsed nodes matches the number\n * of nodes present in the object_info.json\n */\n RUN_BASIC_CHECKS = (): void => {\n const numNodesInSource = Object.keys(this.data.spec).length\n // +1: the injected UnknownNodeXX default schema\n const numNodesInSchema = this.nodes.length - 1\n if (numNodesInSource !== numNodesInSchema) {\n console.log(`🔴 parsed ${numNodesInSchema} nodes but object_info has ${numNodesInSource}`)\n }\n }\n\n hasEmbedding(embedding: string): embedding is EmbeddingName {\n return this.data.embeddings.includes(embedding)\n }\n\n hasLora(loraName: string): boolean {\n return this.getLoras().includes(loraName)\n }\n\n /** all loras on the host, optionally narrowed by a regex */\n getLoras = (filter?: RegExp): string[] => {\n const all = this.stringValues('LoraLoader.lora_name')\n return filter == null ? all : all.filter((n) => filter.test(n))\n }\n\n hasImage(imgName: string): imgName is ComfyImageName {\n return this.getImages().includes(imgName)\n }\n\n getImages = (): string[] => {\n return this.stringValues('LoadImage.image')\n }\n\n /**\n * only use this function after an upload success,\n * when you say this asset is now part of ComfyUI\n **/\n unsafely_addImageInSchemaWithoutReloading = (imgName: ComfyImageName): void => {\n const enumInfo = this.knownUnionBySlotName.get(asComfyNodeSlotName('LoadImage.image'))\n if (enumInfo == null) throw new Error(`LoadImage.image not found`)\n enumInfo.values.push(imgName)\n }\n\n hasCheckpoint(ckptName: string): boolean {\n return this.getCheckpoints().includes(ckptName)\n }\n\n getCheckpoints = (): string[] => {\n return this.stringValues('CheckpointLoaderSimple.ckpt_name')\n }\n}\n","const tab = ' '\n\nexport function readableStringify(obj: unknown, maxLevel = 3, level = 0): string {\n if (level > maxLevel) return JSON.stringify(obj)\n if (typeof obj !== 'object' || obj === null) return JSON.stringify(obj)\n const indent = ' '.repeat(level + 1)\n let result = '{\\n'\n const keys = Object.keys(obj)\n for (let i = 0; i < keys.length; i++) {\n // biome-ignore lint/style/noNonNullAssertion: don't care\n const key = keys[i]!\n // biome-ignore lint/suspicious/noExplicitAny: don't care\n const value = (obj as any)[key]\n if (value === undefined) continue\n const valueType = typeof value\n\n if (i > 0) result += ','\n const thisIndent = i > 0 ? indent.slice(1) : indent\n if (Array.isArray(value)) {\n result += `${thisIndent}${JSON.stringify(key)}: ${JSON.stringify(value)}`\n } else if (valueType === 'object' && value !== null) {\n result += `${thisIndent}${JSON.stringify(key)}: ${readableStringify(value, maxLevel, level + 1)}`\n } else {\n const formattedValue = valueType === 'string' ? JSON.stringify(value) : value\n result += `${thisIndent}${JSON.stringify(key)}: ${formattedValue}`\n }\n result += '\\n'\n }\n result += `${tab.repeat(Math.max(0, level))}}`\n\n return result\n}\n","// fetch a live host's schema and generate its typed sdk\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { join } from 'pathe'\nimport { ComfySchema } from 'src/sdk-generator/ComfySchema.ts'\nimport type { ComfySchemaJSON } from 'src/sdk-generator/ComfyUIObjectInfoTypes.ts'\nimport { readableStringify } from 'src/utils/stringifyReadable.ts'\n\nexport async function runGen(args: string[]): Promise<number> {\n const getFlag = (name: string): string | null => {\n const ix = args.indexOf(`--${name}`)\n return ix >= 0 ? (args[ix + 1] ?? null) : null\n }\n const hostUrl = getFlag('host') ?? 'http://127.0.0.1:8188'\n const id = getFlag('id')\n if (id == null) {\n console.error('[comfy-ts gen] 🔴 --id <host-id> is required (it names .comfy-ts/hosts/<id>/)')\n return 1\n }\n\n // prefer /api/* (canonical prefix; custom nodes like lora-manager hijack the bare routes)\n const fetchJSON = async <T>(route: string): Promise<T> => {\n for (const url of [`${hostUrl}/api${route}`, `${hostUrl}${route}`]) {\n console.log(`[comfy-ts gen] fetching ${url} …`)\n const res = await fetch(url)\n if (!res.ok) continue\n if (!(res.headers.get('content-type') ?? '').includes('json')) continue\n return (await res.json()) as T\n }\n throw new Error(`GET ${route} failed on ${hostUrl} (tried /api${route} and ${route})`)\n }\n\n const spec = await fetchJSON<ComfySchemaJSON>('/object_info')\n const embeddings = await fetchJSON<string[]>('/embeddings').catch(() => [] as string[])\n\n const dir = join(process.cwd(), '.comfy-ts', 'hosts', id)\n mkdirSync(dir, { recursive: true })\n writeFileSync(join(dir, 'object_info.json'), readableStringify(spec, 4), 'utf8')\n writeFileSync(join(dir, 'embeddings.json'), JSON.stringify(embeddings), 'utf8')\n\n const parsed = new ComfySchema({ spec, embeddings })\n const dts = parsed.codegenDTS({ hostId: id })\n const outPath = join(dir, 'sdk.d.ts')\n writeFileSync(outPath, dts, 'utf8')\n console.log(`[comfy-ts gen] 🟢 ${outPath} (${parsed.nodes.length} nodes, ${(dts.length / 1024).toFixed(0)}kB)`)\n console.log(`[comfy-ts gen] add \".comfy-ts/hosts/**/sdk.d.ts\" to your tsconfig \"include\" to activate the types`)\n return 0\n}\n","// outline a generated sdk.d.ts without reading 2MB blind\nimport { existsSync, readdirSync, readFileSync } from 'node:fs'\nimport { join } from 'pathe'\n\ntype Section = { name: string; kind: string; start: number; end: number; depth: number }\n\nfunction findDefaultSdk(): string | null {\n const hostsDir = join(process.cwd(), '.comfy-ts', 'hosts')\n if (!existsSync(hostsDir)) return null\n for (const id of readdirSync(hostsDir)) {\n const p = join(hostsDir, id, 'sdk.d.ts')\n if (existsSync(p)) return p\n }\n return null\n}\n\nexport function runOutline(args: string[]): number {\n const linesFlagIx = args.indexOf('--lines')\n const maxLines = linesFlagIx >= 0 ? Number(args[linesFlagIx + 1] ?? 10) : null\n const sectionFlagIx = args.indexOf('--section')\n const wantedSection = sectionFlagIx >= 0 ? args[sectionFlagIx + 1] : null\n const flagValueIxs = new Set([linesFlagIx + 1, sectionFlagIx + 1].filter((ix) => ix > 0))\n const fileArg = args.find((a, ix) => !a.startsWith('--') && !flagValueIxs.has(ix))\n\n const file = fileArg ?? findDefaultSdk()\n if (file == null || !existsSync(file)) {\n console.error('[sdk-outline] 🔴 no sdk.d.ts found; pass a path explicitly')\n return 1\n }\n\n const lines = readFileSync(file, 'utf8').split('\\n')\n\n // scan: track brace depth, record interface/type/namespace declarations up to depth 3\n const sections: Section[] = []\n const stack: Section[] = []\n let depth = 0\n const declRe = /^\\s*(?:export\\s+)?(interface|namespace|type)\\s+([A-Za-z0-9_$]+)/\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? ''\n const m = depth <= 3 ? declRe.exec(line) : null\n const opens = (line.match(/{/g) ?? []).length\n const closes = (line.match(/}/g) ?? []).length\n if (m && (opens > 0 || m[1] === 'type')) {\n const sec: Section = { name: m[2] ?? '?', kind: m[1] ?? '?', start: i + 1, end: i + 1, depth }\n sections.push(sec)\n if (opens > closes) stack.push(sec)\n }\n depth += opens - closes\n while (stack.length > 0 && depth <= (stack[stack.length - 1]?.depth ?? 0)) {\n const closed = stack.pop()\n if (closed) closed.end = i + 1\n }\n // type aliases (no braces): extend until next decl at same depth\n const last = sections[sections.length - 1]\n if (last && last.kind === 'type' && stack[stack.length - 1] !== last) last.end = Math.max(last.end, i)\n }\n\n if (wantedSection) {\n const sec = sections.find((s) => s.name === wantedSection)\n if (sec == null) {\n console.error(\n `[sdk-outline] 🔴 section \"${wantedSection}\" not found. Available: ${sections.map((s) => s.name).join(', ')}`,\n )\n return 1\n }\n const body = lines.slice(sec.start - 1, maxLines ? Math.min(sec.end, sec.start - 1 + maxLines) : sec.end)\n console.log(body.join('\\n'))\n if (maxLines && sec.end - sec.start + 1 > maxLines)\n console.log(`… (${sec.end - sec.start + 1 - maxLines} more lines, ends at line ${sec.end})`)\n } else {\n console.log(`${file} — ${lines.length} lines\\n`)\n for (const s of sections) {\n const indent = ' '.repeat(s.depth)\n console.log(`${indent}${s.kind} ${s.name} [${s.start}-${s.end}] (${s.end - s.start + 1} lines)`)\n if (maxLines) {\n const body = lines.slice(s.start - 1, s.start - 1 + maxLines)\n console.log(body.map((l) => `${indent} │ ${l.trim()}`).join('\\n'))\n }\n }\n }\n return 0\n}\n","#!/usr/bin/env node\n// sidekick CLI: `bunx comfy-ts <command>` — codegen without writing any code\nimport { runGen } from 'src/cli/gen.ts'\nimport { runOutline } from 'src/cli/outline.ts'\n\nconst HELP = `comfy-ts — typed SDK codegen for ComfyUI\n\nUsage:\n comfy-ts gen --id <host-id> [--host http://127.0.0.1:8188]\n fetch object_info + embeddings from a live ComfyUI host and write\n .comfy-ts/hosts/<host-id>/{object_info.json,embeddings.json,sdk.d.ts}\n\n comfy-ts outline [file] [--lines N] [--section Name]\n outline a generated sdk.d.ts (defaults to the first one in .comfy-ts/hosts/)\n\n comfy-ts tui [dir | workflow-module.ts]\n interactive tweak & re-run over **/*.cflow.ts modules (exporting\n host.defineWorkflow(...)); no arg scans cwd, a file arg preselects it\n\n comfy-ts help\n`\n\nasync function main(): Promise<number> {\n const [cmd, ...rest] = process.argv.slice(2)\n if (cmd === 'gen') return runGen(rest)\n if (cmd === 'outline') return runOutline(rest)\n if (cmd === 'tui') {\n // lazy import: keeps ink/react out of the codegen paths\n const { runTui } = await import('src/cli/tui/run-tui.tsx')\n return runTui(rest)\n }\n console.log(HELP)\n return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