comfy-ts 0.2.0 → 0.4.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.
- package/LICENSE +21 -0
- package/README.md +363 -0
- package/dist/cli.js +764 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +4171 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9910 -0
- package/dist/index.d.ts +9894 -58
- package/dist/index.js +4092 -2
- package/dist/index.js.map +1 -1
- package/dist/log-CdfgILde.js +10 -0
- package/dist/log-CdfgILde.js.map +1 -0
- package/dist/run-tui-SDSJo1Qf.js +3896 -0
- package/dist/run-tui-SDSJo1Qf.js.map +1 -0
- package/package.json +103 -75
- package/src/cli/comfy-ts-cli.ts +36 -0
- package/src/cli/gen.ts +47 -0
- package/src/cli/outline.ts +82 -0
- package/src/cli/tui/components/DraftsOverlay.tsx +44 -0
- package/src/cli/tui/components/EditField.tsx +27 -0
- package/src/cli/tui/components/Header.tsx +56 -0
- package/src/cli/tui/components/HostPanel.tsx +37 -0
- package/src/cli/tui/components/LogsPanel.tsx +23 -0
- package/src/cli/tui/components/LorasOverlay.tsx +49 -0
- package/src/cli/tui/components/OverlayList.tsx +25 -0
- package/src/cli/tui/components/PickerOverlays.tsx +66 -0
- package/src/cli/tui/components/PreviewPanel.tsx +78 -0
- package/src/cli/tui/components/PromptOverlay.tsx +16 -0
- package/src/cli/tui/components/StatusBar.tsx +171 -0
- package/src/cli/tui/components/TextOverlay.tsx +72 -0
- package/src/cli/tui/components/TreePanel.tsx +51 -0
- package/src/cli/tui/components/TuiApp.tsx +246 -0
- package/src/cli/tui/components/VarsPanel.tsx +86 -0
- package/src/cli/tui/findDefinedWorkflow.ts +16 -0
- package/src/cli/tui/keys.ts +20 -0
- package/src/cli/tui/protocolImagePainter.ts +95 -0
- package/src/cli/tui/run-tui.tsx +76 -0
- package/src/cli/tui/state/DraftsSt.ts +273 -0
- package/src/cli/tui/state/EditorSt.ts +289 -0
- package/src/cli/tui/state/ExecSt.ts +173 -0
- package/src/cli/tui/state/HostSt.ts +230 -0
- package/src/cli/tui/state/LogsSt.ts +107 -0
- package/src/cli/tui/state/LorasSt.ts +185 -0
- package/src/cli/tui/state/PickerSt.ts +112 -0
- package/src/cli/tui/state/PreviewSt.ts +288 -0
- package/src/cli/tui/state/QueueSt.ts +59 -0
- package/src/cli/tui/state/SettingsSt.ts +100 -0
- package/src/cli/tui/state/TreeSt.ts +122 -0
- package/src/cli/tui/state/TuiSt.ts +175 -0
- package/src/cli/tui/state/WorkflowsSt.ts +93 -0
- package/src/cli/tui-env.ts +8 -0
- package/src/errors/InvalidPromptError.ts +12 -0
- package/src/graph/ComfyNode.ts +403 -0
- package/src/graph/ComfyNodeID.ts +28 -0
- package/src/graph/ComfyNodeOutput.ts +16 -0
- package/src/graph/NodeSlotSize.ts +4 -0
- package/src/graph/autoValue.ts +17 -0
- package/src/host/ComfyHost.ts +690 -0
- package/src/host/ComfyInstallType.ts +15 -0
- package/src/host/ComfyManager.ts +232 -0
- package/src/host/ComfyUploader.ts +110 -0
- package/src/host/ComfyWorkflowBuilder.ts +60 -0
- package/src/host/Requirements.ts +55 -0
- package/src/host/ResilientWebsocket.ts +147 -0
- package/src/host/loraManagerApi.ts +98 -0
- package/src/image-utils/_getPngMetadata.ts +53 -0
- package/src/image-utils/_getWebpMetadata.ts +38 -0
- package/src/image-utils/_parseExifData.ts +53 -0
- package/src/index.ts +89 -0
- package/src/litegraph/LiteGraphGroup.ts +22 -0
- package/src/litegraph/LiteGraphJSON.ts +46 -0
- package/src/litegraph/LiteGraphLink.ts +23 -0
- package/src/litegraph/LiteGraphLinkID.ts +6 -0
- package/src/litegraph/LiteGraphNode.ts +69 -0
- package/src/litegraph/LiteGraphNodeInput.ts +27 -0
- package/src/litegraph/LiteGraphNodeOutput.ts +23 -0
- package/src/litegraph/LiteGraphSlotIndex.ts +6 -0
- package/src/litegraph/convertFlowToLiteGraphJSON.ts +114 -0
- package/src/manager/ComfyRegistry.ts +124 -0
- package/src/manager/generated/KnownComfyCustomNodeName.ts +19280 -0
- package/src/manager/generated/KnownComfyPluginTitle.ts +5130 -0
- package/src/manager/generated/KnownComfyPluginURL.ts +2589 -0
- package/src/manager/generated/KnownModel_Base.ts +126 -0
- package/src/manager/generated/KnownModel_FileName.ts +2287 -0
- package/src/manager/generated/KnownModel_Name.ts +2287 -0
- package/src/manager/generated/KnownModel_SavePath.ts +263 -0
- package/src/manager/generated/KnownModel_Type.ts +97 -0
- package/src/manager/json/alter-list.json +224 -0
- package/src/manager/json/custom-node-list.extra.ts +13 -0
- package/src/manager/json/custom-node-list.json +21948 -0
- package/src/manager/json/extension-node-map.json +31282 -0
- package/src/manager/json/github-stats.json +12602 -0
- package/src/manager/json/model-list.extra.ts +26 -0
- package/src/manager/json/model-list.json +5052 -0
- package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +56 -0
- package/src/manager/loaders/step2_custom-node-list-loader.ts +149 -0
- package/src/manager/loaders/step3_extension-node-map-loader.ts +189 -0
- package/src/manager/loaders/step4_model-list-loader.ts +159 -0
- package/src/manager/script-update-manager.bun.ts +18 -0
- package/src/manager/types/ComfyManagerAPIFetchPolicy.ts +9 -0
- package/src/manager/types/ComfyManagerAPIModelList.ts +10 -0
- package/src/manager/types/ComfyManagerAPIPluginList.ts +11 -0
- package/src/manager/types/ComfyManagerFileModelInfo.ts +5 -0
- package/src/manager/types/ComfyManagerFilePluginContent.ts +13 -0
- package/src/manager/types/ComfyManagerFilePluginList.ts +5 -0
- package/src/manager/types/ComfyManagerModelInfo.ts +18 -0
- package/src/manager/types/ComfyManagerPluginContentMetadata.ts +16 -0
- package/src/manager/types/ComfyManagerPluginEnums.ts +8 -0
- package/src/manager/types/ComfyManagerPluginInfo.ts +50 -0
- package/src/runner/ComfyExecution.ts +301 -0
- package/src/runner/ComfyExecutionStatus.ts +2 -0
- package/src/runner/ComfyWorkflow.ts +395 -0
- package/src/runner/ComfyWorkflowLayout.ts +96 -0
- package/src/runner/ComfyWsApi.ts +170 -0
- package/src/runner/MediaImage.ts +262 -0
- package/src/sdk-generator/ComfyNodeSchema.ts +79 -0
- package/src/sdk-generator/ComfySchema.ts +369 -0
- package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +95 -0
- package/src/sdk-generator/Primitives.ts +76 -0
- package/src/sdk-generator/_getUnionNameBasedOnFirstFoundEnumName.ts +39 -0
- package/src/sdk-generator/_pythonModuleToNamespace.ts +27 -0
- package/src/sdk-generator/_toQualifiedNodeKey.ts +5 -0
- package/src/sdk-generator/comfy-api-json.ts +16 -0
- package/src/sdk-generator/comfyui-sdk-codegen.ts +287 -0
- package/src/sdk-generator/comfyui-types.ts +56 -0
- package/src/sdk-generator/litegraphToApiRequestPayload.ts +157 -0
- package/src/ssh-host-manager/ssh-config-manager.ts +89 -0
- package/src/ssh-host-manager/ssh-config.windows.md +32 -0
- package/src/ssh-host-manager/ssh-manager.ts +114 -0
- package/src/state.ts +136 -0
- package/src/types/comfy-sdk.ts +106 -0
- package/src/types/index.ts +55 -0
- package/src/utils/CodeBuffer.ts +61 -0
- package/src/utils/ComfyColors.ts +38 -0
- package/src/utils/ansi.ts +33 -0
- package/src/utils/ansiImage.ts +36 -0
- package/src/utils/bang.ts +39 -0
- package/src/utils/deepCopyNaive.ts +1 -0
- package/src/utils/downloadFile.ts +77 -0
- package/src/utils/escapeJSKey.ts +32 -0
- package/src/utils/exhaust.ts +4 -0
- package/src/utils/extractErrorMessage.ts +11 -0
- package/src/utils/fuzzyMatch.ts +8 -0
- package/src/utils/githubRegexes.ts +2 -0
- package/src/utils/hashArrayBuffer.ts +6 -0
- package/src/utils/log.ts +9 -0
- package/src/utils/loraTag.ts +10 -0
- package/src/utils/mojibake.ts +60 -0
- package/src/utils/printArkResultInConsole.ts +16 -0
- package/src/utils/softValidate.ts +8 -0
- package/src/utils/stringifyReadable.ts +32 -0
- package/src/utils/toposort.ts +59 -0
- package/src/utils/tryExtracting.ts +41 -0
- package/src/utils/writeFile.ts +16 -0
- package/src/vars/ComfyVars.ts +531 -0
- package/src/vars/DefinedWorkflow.ts +112 -0
- package/src/vars/loraKeywords.ts +56 -0
- package/dist/index.d.mts +0 -74
- package/dist/index.mjs +0 -3
- package/dist/index.mjs.map +0 -1
- package/readme.md +0 -40
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
2
|
+
|
|
3
|
+
import { downloadFile } from 'src/utils/downloadFile.ts'
|
|
4
|
+
|
|
5
|
+
export async function DownloadComfyManagerJSONs(): Promise<void> {
|
|
6
|
+
await SYNC_modelList()
|
|
7
|
+
await SYNC_customNodeList()
|
|
8
|
+
await SYNC_extensionNodeMap()
|
|
9
|
+
await SYNC_alterList()
|
|
10
|
+
await SYNC_githubStats()
|
|
11
|
+
|
|
12
|
+
async function SYNC_modelList(): Promise<void> {
|
|
13
|
+
await downloadFile(
|
|
14
|
+
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json',
|
|
15
|
+
'src/manager/json/model-list.json',
|
|
16
|
+
`- downloading ynchronizing model-list.json...`,
|
|
17
|
+
)
|
|
18
|
+
console.log(` saved at ${chalk.blue('src/manager/json/model-list.json')}`)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function SYNC_customNodeList(): Promise<void> {
|
|
22
|
+
await downloadFile(
|
|
23
|
+
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json',
|
|
24
|
+
'src/manager/json/custom-node-list.json',
|
|
25
|
+
`- downloading synchronizing custom-node-list.json...`,
|
|
26
|
+
)
|
|
27
|
+
console.log(` saved at ${chalk.blue('src/manager/json/custom-node-list.json')}`)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function SYNC_extensionNodeMap(): Promise<void> {
|
|
31
|
+
await downloadFile(
|
|
32
|
+
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json',
|
|
33
|
+
'src/manager/json/extension-node-map.json',
|
|
34
|
+
`- downloading synchronizing extension-node-map.json...`,
|
|
35
|
+
)
|
|
36
|
+
console.log(` saved at ${chalk.blue('src/manager/json/extension-node-map.json')}`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function SYNC_alterList(): Promise<void> {
|
|
40
|
+
await downloadFile(
|
|
41
|
+
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json',
|
|
42
|
+
'src/manager/json/alter-list.json',
|
|
43
|
+
`- downloading synchronizing alter-list.json...`,
|
|
44
|
+
)
|
|
45
|
+
console.log(` saved at ${chalk.blue('src/manager/json/alter-list.json')}`)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function SYNC_githubStats(): Promise<void> {
|
|
49
|
+
await downloadFile(
|
|
50
|
+
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/refs/heads/main/github-stats.json',
|
|
51
|
+
'src/manager/json/github-stats.json',
|
|
52
|
+
`- downloading ynchronizing githubStats.json...`,
|
|
53
|
+
)
|
|
54
|
+
console.log(` saved at ${chalk.blue('src/manager/json/github-stats.json')}`)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
3
|
+
import { readFileSync, writeFileSync } from 'fs'
|
|
4
|
+
import type { Maybe } from 'src/types/index.ts'
|
|
5
|
+
import { githubRegexpV1 } from 'src/utils/githubRegexes.ts'
|
|
6
|
+
import { printArkResultInConsole } from 'src/utils/printArkResultInConsole.ts'
|
|
7
|
+
import { RecoveryVerbosity, tryRecovering } from 'src/utils/tryExtracting.ts'
|
|
8
|
+
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
9
|
+
import type { KnownComfyPluginTitle } from 'src/manager/generated/KnownComfyPluginTitle.ts'
|
|
10
|
+
import { ComfyPluginExtra } from 'src/manager/json/custom-node-list.extra.ts'
|
|
11
|
+
import {
|
|
12
|
+
type ComfyManagerFilePluginList,
|
|
13
|
+
ComfyManagerFilePluginList_ark,
|
|
14
|
+
} from 'src/manager/types/ComfyManagerFilePluginList.ts'
|
|
15
|
+
import type { ComfyManagerPluginID } from 'src/manager/types/ComfyManagerPluginEnums.ts'
|
|
16
|
+
import type { ComfyManagerPluginInfo } from 'src/manager/types/ComfyManagerPluginInfo.ts'
|
|
17
|
+
|
|
18
|
+
export type GetKnownPluginProps = {
|
|
19
|
+
//
|
|
20
|
+
updateCache?: boolean
|
|
21
|
+
check?: boolean
|
|
22
|
+
genTypes?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const _getKnownPlugins = (DB: ComfyRegistry): void => {
|
|
26
|
+
let totalFileSeen = 0
|
|
27
|
+
let totalPluginSeen = 0
|
|
28
|
+
|
|
29
|
+
// load raw json
|
|
30
|
+
const knownPluginFile: ComfyManagerFilePluginList = JSON.parse(
|
|
31
|
+
readFileSync('src/manager/json/custom-node-list.json', 'utf8'),
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
// merge with extra
|
|
35
|
+
const knownPluginList: ComfyManagerPluginInfo[] = knownPluginFile.custom_nodes.concat(ComfyPluginExtra)
|
|
36
|
+
|
|
37
|
+
// auto-fix the (more often than not) json file
|
|
38
|
+
// please... add validation or CI check or something!
|
|
39
|
+
for (const plugin of knownPluginList) {
|
|
40
|
+
plugin.id ??= tryRecoveringPluginId(plugin, RecoveryVerbosity.info)
|
|
41
|
+
plugin.title ??= tryRecoveringPluginTitle(plugin, RecoveryVerbosity.info)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// validate file is well-formed
|
|
45
|
+
const res = ComfyManagerFilePluginList_ark(knownPluginFile)
|
|
46
|
+
if (DB.opts.check) {
|
|
47
|
+
if (res instanceof type.errors) {
|
|
48
|
+
printArkResultInConsole(res)
|
|
49
|
+
process.exit(1)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (const plugin of knownPluginList) {
|
|
54
|
+
// INITIALIZATION ------------------------------------------------------------
|
|
55
|
+
totalPluginSeen++
|
|
56
|
+
if (DB.opts.check && DB.plugins_byTitle.has(plugin.title))
|
|
57
|
+
console.log(` ❌ plugin.title: "${plugin.title}" is duplicated`)
|
|
58
|
+
DB.plugins_byTitle.set(plugin.title, plugin)
|
|
59
|
+
for (const pluginURI of plugin.files) {
|
|
60
|
+
totalFileSeen++
|
|
61
|
+
if (DB.opts.check && DB.plugins_byFile.has(pluginURI))
|
|
62
|
+
console.log(` ❌ plugin.file: "${pluginURI}" is duplicated`)
|
|
63
|
+
DB.plugins_byFile.set(pluginURI, plugin)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// CODEGEN ------------------------------------------------------------
|
|
68
|
+
if (DB.opts.genTypes) {
|
|
69
|
+
let out1 = ''
|
|
70
|
+
// TitleType
|
|
71
|
+
const allPlugins = [...DB.plugins_byTitle.values()]
|
|
72
|
+
const allPluginsSortedByTitles = allPlugins.sort((a, b) =>
|
|
73
|
+
(a.title ?? '❌missing-title').toLowerCase().localeCompare((b.title ?? '❌missing-title').toLowerCase()),
|
|
74
|
+
)
|
|
75
|
+
out1 += '// prettier-ignore\n'
|
|
76
|
+
out1 += 'export type KnownComfyPluginTitle =\n'
|
|
77
|
+
for (const plugin of allPluginsSortedByTitles) {
|
|
78
|
+
out1 += ` /** ${plugin.id} - ${plugin.reference} */\n`
|
|
79
|
+
out1 += ` | ${JSON.stringify(plugin.title)}\n`
|
|
80
|
+
}
|
|
81
|
+
out1 += '\n'
|
|
82
|
+
const out1Path = 'src/manager/generated/KnownComfyPluginTitle.ts'
|
|
83
|
+
writeFileSync(out1Path, out1 + '\n', 'utf-8')
|
|
84
|
+
console.log(` > generated: ${chalk.blue.underline(out1Path)}`)
|
|
85
|
+
|
|
86
|
+
// FileType
|
|
87
|
+
let out2 = ''
|
|
88
|
+
const allFileNames = [...DB.plugins_byFile.keys()]
|
|
89
|
+
const sortedFileNames = allFileNames.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
|
|
90
|
+
out2 += '// prettier-ignore\n'
|
|
91
|
+
out2 += 'export type KnownComfyPluginURL =\n'
|
|
92
|
+
for (const fileName of sortedFileNames) out2 += ` | ${JSON.stringify(fileName)}\n`
|
|
93
|
+
// out2 += '\n'
|
|
94
|
+
const out2Path = 'src/manager/generated/KnownComfyPluginURL.ts'
|
|
95
|
+
writeFileSync(out2Path, out2, 'utf-8')
|
|
96
|
+
console.log(` > generated: ${chalk.blue.underline(out2Path)}`)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// INDEXING CHECKS ------------------------------------------------------------
|
|
100
|
+
if (DB.opts.check) {
|
|
101
|
+
// console.log(`${knownModelList.length} models found`)
|
|
102
|
+
console.log(` - ${totalPluginSeen} CustomNodes in file`)
|
|
103
|
+
console.log(` - ${DB.plugins_byTitle.size} CustomNodes registered in map`)
|
|
104
|
+
console.log(` - ${totalFileSeen} CustomNodes-File Seen`)
|
|
105
|
+
console.log(` - ${DB.plugins_byFile.size} CustomNodes-File registered in map`)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function tryRecoveringPluginTitle(
|
|
110
|
+
plugin: ComfyManagerPluginInfo,
|
|
111
|
+
verbose = RecoveryVerbosity.Quiet,
|
|
112
|
+
): KnownComfyPluginTitle {
|
|
113
|
+
return tryRecovering<KnownComfyPluginTitle>({
|
|
114
|
+
property: 'plugin.title',
|
|
115
|
+
verbose,
|
|
116
|
+
hacks: [
|
|
117
|
+
{
|
|
118
|
+
attempt: 'id',
|
|
119
|
+
fn: (): Maybe<KnownComfyPluginTitle> => plugin.id as KnownComfyPluginTitle,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
attempt: 'github repo name',
|
|
123
|
+
fn: (): Maybe<KnownComfyPluginTitle> => plugin.reference as KnownComfyPluginTitle,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function tryRecoveringPluginId(
|
|
130
|
+
//
|
|
131
|
+
plugin: ComfyManagerPluginInfo,
|
|
132
|
+
verbose = RecoveryVerbosity.Quiet,
|
|
133
|
+
): string {
|
|
134
|
+
return tryRecovering<ComfyManagerPluginID>({
|
|
135
|
+
property: 'plugin.id',
|
|
136
|
+
verbose,
|
|
137
|
+
hacks: [
|
|
138
|
+
{
|
|
139
|
+
level: RecoveryVerbosity.Verbose,
|
|
140
|
+
attempt: 'title',
|
|
141
|
+
fn: (): Maybe<ComfyManagerPluginID> => plugin.title as ComfyManagerPluginInfo['title'],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
attempt: 'github repo name',
|
|
145
|
+
fn: (): Maybe<string> => plugin.reference.match(githubRegexpV1)?.[2],
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
})
|
|
149
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { type } from 'arktype'
|
|
3
|
+
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
4
|
+
import { toQualifiedNodeKey } from 'src/sdk-generator/_toQualifiedNodeKey.ts'
|
|
5
|
+
import type { NodeNameInComfy } from 'src/sdk-generator/comfyui-types.ts'
|
|
6
|
+
import { githubRegexpV2 } from 'src/utils/githubRegexes.ts'
|
|
7
|
+
import { printArkResultInConsole } from 'src/utils/printArkResultInConsole.ts'
|
|
8
|
+
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
9
|
+
import type { KnownComfyCustomNodeName } from 'src/manager/generated/KnownComfyCustomNodeName.ts'
|
|
10
|
+
import type { KnownComfyPluginURL } from 'src/manager/generated/KnownComfyPluginURL.ts'
|
|
11
|
+
import {
|
|
12
|
+
type ComfyManagerFilePluginContent,
|
|
13
|
+
ComfyManagerFilePluginContent_ark,
|
|
14
|
+
} from 'src/manager/types/ComfyManagerFilePluginContent.ts'
|
|
15
|
+
import type { ComfyManagerPluginContentMetadata } from 'src/manager/types/ComfyManagerPluginContentMetadata.ts'
|
|
16
|
+
import type { ComfyManagerPluginInfo } from 'src/manager/types/ComfyManagerPluginInfo.ts'
|
|
17
|
+
|
|
18
|
+
export const _getCustomNodeRegistry = (DB: ComfyRegistry): void => {
|
|
19
|
+
let totalCustomNodeSeen: number = 0
|
|
20
|
+
|
|
21
|
+
// 1. read file
|
|
22
|
+
const extensionNodeMapFile: ComfyManagerFilePluginContent = JSON.parse(
|
|
23
|
+
readFileSync('src/manager/json/extension-node-map.json', 'utf8'),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
// validate file is well-formed
|
|
27
|
+
const res = ComfyManagerFilePluginContent_ark(extensionNodeMapFile)
|
|
28
|
+
|
|
29
|
+
if (DB.opts.check) {
|
|
30
|
+
if (res instanceof type.errors) {
|
|
31
|
+
printArkResultInConsole(res)
|
|
32
|
+
process.exit(1)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 2. process file into something slightly more practical to use
|
|
37
|
+
type ComfyManagerFilePluginContent_asObject = {
|
|
38
|
+
url: string
|
|
39
|
+
comfyNodeNames: NodeNameInComfy[]
|
|
40
|
+
meta: ComfyManagerPluginContentMetadata
|
|
41
|
+
/** should be what we will received once the plugin in installed */
|
|
42
|
+
pythonModule: string
|
|
43
|
+
/** plugin that contains this url listed in files */
|
|
44
|
+
plugin: ComfyManagerPluginInfo
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const enmEntries: ComfyManagerFilePluginContent_asObject[] = Object.entries(extensionNodeMapFile).map(
|
|
48
|
+
(
|
|
49
|
+
x: [url: string, infos: [NodeNameInComfy[], ComfyManagerPluginContentMetadata]],
|
|
50
|
+
): ComfyManagerFilePluginContent_asObject => {
|
|
51
|
+
const url = x[0]
|
|
52
|
+
const [comfyNodeNames, meta] = x[1]
|
|
53
|
+
const confyPlugin = DB.plugins_byFile.get(url as KnownComfyPluginURL)
|
|
54
|
+
if (confyPlugin == null) throw new Error(`[❌] plugin not found for ${url}`)
|
|
55
|
+
return {
|
|
56
|
+
url,
|
|
57
|
+
comfyNodeNames,
|
|
58
|
+
meta,
|
|
59
|
+
plugin: confyPlugin,
|
|
60
|
+
pythonModule: reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(confyPlugin, url, meta),
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
// 3. for each file
|
|
66
|
+
for (const enmEntry of enmEntries) {
|
|
67
|
+
totalCustomNodeSeen += enmEntry.comfyNodeNames.length
|
|
68
|
+
// JSON CHECKS ------------------------------------------------------------
|
|
69
|
+
// if (!hasErrors && DB.opts.check) {
|
|
70
|
+
// const valid = Value.Check(ComfyManagerPluginContentMetadata_typebox, enmEntry.meta)
|
|
71
|
+
// if (!valid) {
|
|
72
|
+
// const errors: ValueError[] = [
|
|
73
|
+
// ...Value.Errors(ComfyManagerPluginContentMetadata_typebox, enmEntry.meta),
|
|
74
|
+
// ]
|
|
75
|
+
// console.error(`❌ extensionNodeMap doesn't match schema:`, enmEntry.meta)
|
|
76
|
+
// // console.error(`❌ errors`, errors)
|
|
77
|
+
// for (const i of errors) console.log(`❌`, JSON.stringify(i))
|
|
78
|
+
// hasErrors = true
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// 3 ensure we have a list of nodes for this plugin
|
|
83
|
+
const plugin = enmEntry.plugin
|
|
84
|
+
const nodesInPlugin: KnownComfyCustomNodeName[] = DB.customNodes_byPluginName.get(plugin.title) ?? []
|
|
85
|
+
DB.customNodes_byPluginName.set(plugin.title, nodesInPlugin)
|
|
86
|
+
|
|
87
|
+
// INITIALIZATION ------------------------------------------------------------
|
|
88
|
+
// 4. for each node in file
|
|
89
|
+
for (const nodeNameInComfy of enmEntry.comfyNodeNames) {
|
|
90
|
+
// 4.1. index the plugin for this node name
|
|
91
|
+
// const prevEntry1 = DB.plugins_byNodeNameInComfy.get(nodeNameInComfy)
|
|
92
|
+
// if (prevEntry1 == null) DB.plugins_byNodeNameInComfy.set(nodeNameInComfy, [plugin])
|
|
93
|
+
// else prevEntry1.push(plugin)
|
|
94
|
+
|
|
95
|
+
// 4.2 index by nodeKey
|
|
96
|
+
// const nodeKey = convertComfyNodeNameToCushyNodeNameValidInJS(nodeNameInComfy)
|
|
97
|
+
|
|
98
|
+
const nodeKey = toQualifiedNodeKey(enmEntry.pythonModule, nodeNameInComfy)
|
|
99
|
+
// console.log(`[🤠] nodeKey=`, JSON.stringify(nodeKey), enmEntry.pythonModule)
|
|
100
|
+
// process.exit(2)
|
|
101
|
+
const prevEntry2 = DB.plugins_byNodeKey.get(nodeKey)
|
|
102
|
+
if (prevEntry2 == null) DB.plugins_byNodeKey.set(nodeKey, [plugin])
|
|
103
|
+
else prevEntry2.push(plugin)
|
|
104
|
+
|
|
105
|
+
// 4.3. index the node in the plugin (file is only giving index by files...)
|
|
106
|
+
nodesInPlugin.push(nodeKey as KnownComfyCustomNodeName)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 6. CODEGEN ------------------------------------------------------------
|
|
111
|
+
if (DB.opts.genTypes) {
|
|
112
|
+
let out = ''
|
|
113
|
+
|
|
114
|
+
// NameInCushy
|
|
115
|
+
const allNodeKeys = [...DB.plugins_byNodeKey.keys()]
|
|
116
|
+
const sortedNodeKeys = allNodeKeys.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
|
|
117
|
+
out += '// prettier-ignore\n'
|
|
118
|
+
out += 'export type KnownComfyCustomNodeName =\n'
|
|
119
|
+
for (const nodeName of sortedNodeKeys) {
|
|
120
|
+
if (nodeName === 'sd_perturbed_attention.PerturbedAttention') {
|
|
121
|
+
console.log(`[🤠] 🔴`, DB.plugins_byNodeKey.get(nodeName))
|
|
122
|
+
}
|
|
123
|
+
out += ` | ${JSON.stringify(nodeName)}\n`
|
|
124
|
+
}
|
|
125
|
+
out += '\n'
|
|
126
|
+
|
|
127
|
+
const outPath = 'src/manager/generated/KnownComfyCustomNodeName.ts'
|
|
128
|
+
writeFileSync(outPath, out + '\n', 'utf-8')
|
|
129
|
+
console.log(` > generated: ${chalk.blue.underline(outPath)}`)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// // INDEXING CHECKS ------------------------------------------------------------
|
|
133
|
+
if (DB.opts.check) {
|
|
134
|
+
//
|
|
135
|
+
// console.log(`${knownModelList.length} models found`)
|
|
136
|
+
console.log(` - ${totalCustomNodeSeen} CustomNodes unique names processed`)
|
|
137
|
+
// console.log(`${CustomNodeURL.byNodeNameInComfy.size} CustomNodes registered in map`)
|
|
138
|
+
// if (totalPluginSeen !== CustomNodeURL.byNodeNameInComfy.size)
|
|
139
|
+
// console.log(`❌ some customNodes are either duplicated or have overlapping titles`)
|
|
140
|
+
|
|
141
|
+
// console.log(`${totalCustomNodeSeen} CustomNodes-File Seen`)
|
|
142
|
+
// console.log(`${CustomNodeURL.byNodeNameInCushy.size} CustomNodes-File registered in map`)
|
|
143
|
+
// if (totalCustomNodeSeen !== CustomNodeURL.byNodeNameInCushy.size)
|
|
144
|
+
// console.log(`❌ some customNodes are either duplicated or have overlapping files`)
|
|
145
|
+
|
|
146
|
+
// if (hasErrors) console.log(`❌ some CustomNodes don't match schema`)
|
|
147
|
+
// else console.log(`✅ all CustomNodes match schema`)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// return DB
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// // need to be an array, because multiple custom nodes can have the same name
|
|
154
|
+
// type CustomNodeURL_by_NodeNameInComfy = Map<NodeNameInComfy, KnownComfyPluginURL[]>
|
|
155
|
+
// type CustomNodeURL_by_NodeNameInCushy = Map<QualifiedNodeKey, KnownComfyPluginURL[]>
|
|
156
|
+
// type CustomNodes_by_PluginTitle = Map<KnownComfyPluginURL, QualifiedNodeKey[]>
|
|
157
|
+
|
|
158
|
+
// type CustomNodeRegistry = {
|
|
159
|
+
// byNodeNameInComfy: CustomNodeURL_by_NodeNameInComfy
|
|
160
|
+
// byNodeNameInCushy: CustomNodeURL_by_NodeNameInCushy
|
|
161
|
+
// byPluginName: CustomNodes_by_PluginTitle
|
|
162
|
+
// }
|
|
163
|
+
|
|
164
|
+
// let DB: Maybe<CustomNodeRegistry> = null // = knownCustomNodesFile.custom_nodes
|
|
165
|
+
|
|
166
|
+
function reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(
|
|
167
|
+
plugin: ComfyManagerPluginInfo,
|
|
168
|
+
_url: string,
|
|
169
|
+
_meta: ComfyManagerPluginContentMetadata,
|
|
170
|
+
): string {
|
|
171
|
+
if (plugin.id === 'nodes' && plugin.reference === 'https://github.com/comfyanonymous/ComfyUI') return 'nodes'
|
|
172
|
+
|
|
173
|
+
// if (meta.pythonModule) {
|
|
174
|
+
// // console.log(`[🤠] got via pythonModule`, meta.pythonModule)
|
|
175
|
+
// return meta.pythonModule
|
|
176
|
+
// }
|
|
177
|
+
const repoName = plugin.reference.match(githubRegexpV2)?.[2]
|
|
178
|
+
// console.log(`[🤠] ${plugin.reference} => ${repoName}`)
|
|
179
|
+
if (repoName) {
|
|
180
|
+
// console.log(`[🤠] got via repoName`, plugin.reference, `custom_nodes.${repoName}`)
|
|
181
|
+
return `custom_nodes.${repoName}`
|
|
182
|
+
}
|
|
183
|
+
if (plugin.id) {
|
|
184
|
+
// console.log(`[🤠] got via repoName`, plugin.id, `custom_nodes.${plugin.id}`)
|
|
185
|
+
return `custom_nodes.${plugin.id}`
|
|
186
|
+
}
|
|
187
|
+
const pythonModule = '🔴'
|
|
188
|
+
return pythonModule
|
|
189
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { type ArkErrors, type } from 'arktype'
|
|
2
|
+
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
3
|
+
// https://github.com/ltdrdata/ComfyUI-Manager/blob/main/model-list.json
|
|
4
|
+
import { readFileSync, writeFileSync } from 'fs'
|
|
5
|
+
import { printArkResultInConsole } from 'src/utils/printArkResultInConsole.ts'
|
|
6
|
+
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
7
|
+
import type { KnownModel_Name } from 'src/manager/generated/KnownModel_Name.ts'
|
|
8
|
+
import { extraModels } from 'src/manager/json/model-list.extra.ts'
|
|
9
|
+
import type { ComfyManagerFileModelInfo } from 'src/manager/types/ComfyManagerFileModelInfo.ts'
|
|
10
|
+
import { ComfyManagerModelInfo_ark } from 'src/manager/types/ComfyManagerModelInfo.ts'
|
|
11
|
+
|
|
12
|
+
export const _getKnownModels = (
|
|
13
|
+
DB: ComfyRegistry /* {
|
|
14
|
+
} */,
|
|
15
|
+
): void => {
|
|
16
|
+
const knownModelsFile: ComfyManagerFileModelInfo = JSON.parse(
|
|
17
|
+
readFileSync('src/manager/json/model-list.json', 'utf8'),
|
|
18
|
+
)
|
|
19
|
+
const knownModelList = knownModelsFile.models.concat(extraModels.models)
|
|
20
|
+
|
|
21
|
+
let hasErrors = false
|
|
22
|
+
|
|
23
|
+
for (const modelInfo of knownModelList) {
|
|
24
|
+
// INITIALIZATION ------------------------------------------------------------
|
|
25
|
+
DB.knownModels.set(modelInfo.name as KnownModel_Name, modelInfo)
|
|
26
|
+
|
|
27
|
+
// JSON CHECKS -----------------------------------------------------------
|
|
28
|
+
if (!hasErrors && DB.opts.check) {
|
|
29
|
+
const res = ComfyManagerModelInfo_ark(modelInfo)
|
|
30
|
+
if (res instanceof type.errors) {
|
|
31
|
+
const errors: ArkErrors = res
|
|
32
|
+
console.error(`❌ model doesn't match schema:`, modelInfo)
|
|
33
|
+
printArkResultInConsole(errors)
|
|
34
|
+
hasErrors = true
|
|
35
|
+
// debugger
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// CODEGEN ------------------------------------------------------------
|
|
41
|
+
if (DB.opts.genTypes) {
|
|
42
|
+
// #region type
|
|
43
|
+
let out1 = ''
|
|
44
|
+
const uniqCategories: { [key: string]: number } = knownModelList.reduce(
|
|
45
|
+
(acc, cur) => {
|
|
46
|
+
if (acc[cur.type] != null) acc[cur.type]! += 1
|
|
47
|
+
else acc[cur.type] = 1
|
|
48
|
+
return acc
|
|
49
|
+
},
|
|
50
|
+
{} as { [key: string]: number },
|
|
51
|
+
)
|
|
52
|
+
out1 += `// prettier-ignore\n`
|
|
53
|
+
out1 += 'export type KnownModel_Type =\n'
|
|
54
|
+
for (const [cat, count] of Object.entries(uniqCategories))
|
|
55
|
+
out1 += ` | ${JSON.stringify(cat).padEnd(20)} // x ${count.toString().padStart(3)}\n`
|
|
56
|
+
out1 += '\n'
|
|
57
|
+
out1 += 'export const knownModel_Type: KnownModel_Type[] = [\n'
|
|
58
|
+
for (const [cat, count] of Object.entries(uniqCategories))
|
|
59
|
+
out1 += ` ${JSON.stringify(cat).padEnd(20)}, // x ${count.toString().padStart(3)}\n`
|
|
60
|
+
out1 += ']\n'
|
|
61
|
+
const out1Path = 'src/manager/generated/KnownModel_Type.ts'
|
|
62
|
+
writeFileSync(out1Path, out1 + '\n', 'utf-8')
|
|
63
|
+
console.log(` > generated: ${chalk.blue.underline(out1Path)}`)
|
|
64
|
+
|
|
65
|
+
// #region savepath
|
|
66
|
+
let out4 = ''
|
|
67
|
+
const uniqSavePath: { [key: string]: number } = knownModelList.reduce(
|
|
68
|
+
(acc, cur) => {
|
|
69
|
+
if (acc[cur.save_path] != null) acc[cur.save_path]! += 1
|
|
70
|
+
else acc[cur.save_path] = 1
|
|
71
|
+
return acc
|
|
72
|
+
},
|
|
73
|
+
{} as { [key: string]: number },
|
|
74
|
+
)
|
|
75
|
+
out4 += `// prettier-ignore\n`
|
|
76
|
+
out4 += 'export type KnownModel_SavePath =\n'
|
|
77
|
+
for (const [cat, count] of Object.entries(uniqSavePath))
|
|
78
|
+
out4 += ` | ${JSON.stringify(cat).padEnd(50)} // x ${count.toString().padStart(3)}\n`
|
|
79
|
+
out4 += '\n'
|
|
80
|
+
out4 += 'export const knownModel_SavePath: KnownModel_SavePath[] = [\n'
|
|
81
|
+
for (const [cat, count] of Object.entries(uniqSavePath))
|
|
82
|
+
out4 += ` ${JSON.stringify(cat).padEnd(50)}, // x ${count.toString().padStart(3)}\n`
|
|
83
|
+
out4 += ']\n'
|
|
84
|
+
const out4Path = 'src/manager/generated/KnownModel_SavePath.ts'
|
|
85
|
+
writeFileSync(out4Path, out4 + '\n', 'utf-8')
|
|
86
|
+
console.log(` > generated: ${chalk.blue.underline(out4Path)}`)
|
|
87
|
+
|
|
88
|
+
// #region base
|
|
89
|
+
let out2 = ''
|
|
90
|
+
const uniqBases: { [key: string]: number } = knownModelList.reduce(
|
|
91
|
+
(acc, cur) => {
|
|
92
|
+
if (acc[cur.base] != null) acc[cur.base]! += 1
|
|
93
|
+
else acc[cur.base] = 1
|
|
94
|
+
return acc
|
|
95
|
+
},
|
|
96
|
+
{} as { [key: string]: number },
|
|
97
|
+
)
|
|
98
|
+
out2 += `// prettier-ignore\n`
|
|
99
|
+
out2 += 'export type KnownModel_Base =\n'
|
|
100
|
+
for (const [cat, count] of Object.entries(uniqBases))
|
|
101
|
+
out2 += ` | ${JSON.stringify(cat).padEnd(20)} // x ${count.toString().padStart(3)}\n`
|
|
102
|
+
out2 += '\n'
|
|
103
|
+
out2 += '// prettier-ignore\n'
|
|
104
|
+
out2 += 'export const knownModel_Base: KnownModel_Base[] = [\n'
|
|
105
|
+
for (const [cat, count] of Object.entries(uniqBases))
|
|
106
|
+
out2 += ` ${JSON.stringify(cat).padEnd(20)}, // x ${count.toString().padStart(3)}\n`
|
|
107
|
+
out2 += ']\n'
|
|
108
|
+
const out2Path = 'src/manager/generated/KnownModel_Base.ts'
|
|
109
|
+
writeFileSync(out2Path, out2 + '\n', 'utf-8')
|
|
110
|
+
console.log(` > generated: ${chalk.blue.underline(out2Path)}`)
|
|
111
|
+
|
|
112
|
+
// #region KnownModel_Name
|
|
113
|
+
let out3 = ''
|
|
114
|
+
const sortedModels = knownModelList.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()))
|
|
115
|
+
out3 += `// prettier-ignore\n`
|
|
116
|
+
out3 += 'export type KnownModel_Name =\n'
|
|
117
|
+
for (const mi of sortedModels) {
|
|
118
|
+
out3 += ` /** ${mi.description}\n`
|
|
119
|
+
out3 += ` * ${mi.size} - ${mi.url}\n`
|
|
120
|
+
out3 += ` * see ${mi.reference}\n`
|
|
121
|
+
out3 += ` */\n`
|
|
122
|
+
out3 += ` | ${JSON.stringify(mi.name)}\n`
|
|
123
|
+
}
|
|
124
|
+
out3 += '\n'
|
|
125
|
+
const out3Path = 'src/manager/generated/KnownModel_Name.ts'
|
|
126
|
+
writeFileSync(out3Path, out3 + '\n', 'utf-8')
|
|
127
|
+
console.log(` > generated: ${chalk.blue.underline(out3Path)}`)
|
|
128
|
+
|
|
129
|
+
// #region KnownModel_FileName
|
|
130
|
+
let out99 = ''
|
|
131
|
+
out99 += `// prettier-ignore\n`
|
|
132
|
+
out99 += 'export type KnownModel_FileName =\n'
|
|
133
|
+
for (const mi of sortedModels) {
|
|
134
|
+
out99 += ` /** ${mi.description}\n`
|
|
135
|
+
out99 += ` * ${mi.size} - ${mi.url}\n`
|
|
136
|
+
out99 += ` * see ${mi.reference}\n`
|
|
137
|
+
out99 += ` */\n`
|
|
138
|
+
out99 += ` | ${JSON.stringify(mi.filename)}\n`
|
|
139
|
+
}
|
|
140
|
+
out99 += '\n'
|
|
141
|
+
const out99Path = 'src/manager/generated/KnownModel_FileName.ts'
|
|
142
|
+
writeFileSync(out99Path, out99 + '\n', 'utf-8')
|
|
143
|
+
console.log(` > generated: ${chalk.blue.underline(out99Path)}`)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// INDEXING CHECKS ------------------------------------------------------------
|
|
147
|
+
if (DB.opts.check) {
|
|
148
|
+
//
|
|
149
|
+
console.log(`${knownModelList.length} models found`)
|
|
150
|
+
console.log(`${DB.knownModels.size} models registered map`)
|
|
151
|
+
if (knownModelList.length !== DB.knownModels.size)
|
|
152
|
+
console.log(`❌ some models are either duplicated or have overlapping indexing keys`)
|
|
153
|
+
//
|
|
154
|
+
if (hasErrors) console.log(`❌ some models don't match schema`)
|
|
155
|
+
else console.log(`✅ all models match schema`)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// return DB.knownModels
|
|
159
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
2
|
+
|
|
3
|
+
import { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
4
|
+
|
|
5
|
+
const skipDL = process.argv.includes('--skip-download')
|
|
6
|
+
|
|
7
|
+
console.clear()
|
|
8
|
+
console.log(chalk.bold.greenBright('UPDADING COMFY MANAGER JSONS'))
|
|
9
|
+
|
|
10
|
+
// should take care of the code generation
|
|
11
|
+
await ComfyRegistry.DownloadAndUpdate(!skipDL)
|
|
12
|
+
|
|
13
|
+
// the generator aligns its own `// x N` comments and emits trailing blank
|
|
14
|
+
// lines; oxfmt disagrees on both, so WITHOUT this the ci gate goes red right
|
|
15
|
+
// after any regeneration. Runs here, not chained in package.json: a `&&` there
|
|
16
|
+
// swallows this script's own flags (`--skip-download` landed on oxfmt).
|
|
17
|
+
const fmt = Bun.spawnSync(['oxfmt', 'src/manager/generated'], { stdout: 'inherit', stderr: 'inherit' })
|
|
18
|
+
if (fmt.exitCode !== 0) throw new Error(`🔴 oxfmt failed on src/manager/generated (exit ${fmt.exitCode})`)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 'cache' : DB: Channel (1day cache)'
|
|
5
|
+
* 'local' : local 'DB: Local'
|
|
6
|
+
* 'url' : DB: Channel (remote)
|
|
7
|
+
*/
|
|
8
|
+
export type ComfyManagerAPIFetchPolicy = typeof ComfyManagerAPIFetchPolicy_ark.infer
|
|
9
|
+
export const ComfyManagerAPIFetchPolicy_ark = type("'cache' | 'local' | 'url'")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
import type { KnownModel_Name } from 'src/manager/generated/KnownModel_Name.ts'
|
|
3
|
+
|
|
4
|
+
export type ComfyManagerAPIModelList = typeof ComfyManagerAPIModelList_ark.infer
|
|
5
|
+
export const ComfyManagerAPIModelList_ark = type({
|
|
6
|
+
models: type({
|
|
7
|
+
name: type.string.as<KnownModel_Name>(),
|
|
8
|
+
installed: `'False' | 'True' | 'Update'`,
|
|
9
|
+
}).array(),
|
|
10
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
import type { KnownComfyPluginTitle } from 'src/manager/generated/KnownComfyPluginTitle.ts'
|
|
3
|
+
|
|
4
|
+
export type ComfyManagerAPIPluginList = typeof ComfyManagerAPIPluginList_ark.infer
|
|
5
|
+
export const ComfyManagerAPIPluginList_ark = type({
|
|
6
|
+
custom_nodes: type({
|
|
7
|
+
title: type.string.as<KnownComfyPluginTitle>(),
|
|
8
|
+
installed: `'False' | 'True' | 'Update'`,
|
|
9
|
+
}).array(),
|
|
10
|
+
chanel: 'string',
|
|
11
|
+
})
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
import { ComfyManagerModelInfo_ark } from 'src/manager/types/ComfyManagerModelInfo.ts'
|
|
3
|
+
|
|
4
|
+
export type ComfyManagerFileModelInfo = typeof ComfyManagerFileModelInfo_ark.infer
|
|
5
|
+
export const ComfyManagerFileModelInfo_ark = type({ models: ComfyManagerModelInfo_ark.array() })
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
import { ComfyManagerPluginContentMetadata_ark } from 'src/manager/types/ComfyManagerPluginContentMetadata.ts'
|
|
3
|
+
import { ComfyManagerPluginContentNodeName_ark } from 'src/manager/types/ComfyManagerPluginEnums.ts'
|
|
4
|
+
|
|
5
|
+
export type ComfyManagerFilePluginContent = typeof ComfyManagerFilePluginContent_ark.infer
|
|
6
|
+
export const ComfyManagerFilePluginContent_ark = type.Record(
|
|
7
|
+
'string',
|
|
8
|
+
type([
|
|
9
|
+
//
|
|
10
|
+
ComfyManagerPluginContentNodeName_ark.array(),
|
|
11
|
+
ComfyManagerPluginContentMetadata_ark,
|
|
12
|
+
]),
|
|
13
|
+
)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
import { ComfyManagerPluginInfo_ark } from 'src/manager/types/ComfyManagerPluginInfo.ts'
|
|
3
|
+
|
|
4
|
+
export type ComfyManagerFilePluginList = typeof ComfyManagerFilePluginList_ark.infer
|
|
5
|
+
export const ComfyManagerFilePluginList_ark = type({ custom_nodes: ComfyManagerPluginInfo_ark.array() })
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type } from 'arktype'
|
|
2
|
+
import type { KnownModel_Base } from 'src/manager/generated/KnownModel_Base.ts'
|
|
3
|
+
import type { KnownModel_Name } from 'src/manager/generated/KnownModel_Name.ts'
|
|
4
|
+
import type { KnownModel_SavePath } from 'src/manager/generated/KnownModel_SavePath.ts'
|
|
5
|
+
import type { KnownModel_Type } from 'src/manager/generated/KnownModel_Type.ts'
|
|
6
|
+
|
|
7
|
+
export type ComfyManagerModelInfo = typeof ComfyManagerModelInfo_ark.infer
|
|
8
|
+
export const ComfyManagerModelInfo_ark = type({
|
|
9
|
+
name: type.string.as<KnownModel_Name>(), // e.g. "ip-adapter_sd15_light.safetensors",
|
|
10
|
+
type: type.string.as<KnownModel_Type>(), // e.g. "IP-Adapter",
|
|
11
|
+
base: type.string.as<KnownModel_Base>(), // e.g. "SD1.5",
|
|
12
|
+
save_path: type.string.as<KnownModel_SavePath>(), // e.g. "ipadapter",
|
|
13
|
+
description: 'string', // e.g. "You can use this model in the [a/ComfyUI IPAdapter plus](https://github.com/cubiq/ComfyUI_IPAdapter_plus) extension.",
|
|
14
|
+
reference: 'string', // e.g. "https://huggingface.co/h94/IP-Adapter",
|
|
15
|
+
filename: 'string', // e.g. "ip-adapter_sd15_light.safetensors",
|
|
16
|
+
url: 'string', // e.g. "https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15_light.safetensors"
|
|
17
|
+
'size?': 'string', // e.g. "698.4MB"
|
|
18
|
+
})
|