comfy-ts 2.10.0 → 2.12.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/README.md +1 -0
- package/dist/{LogsSt-DFxzQfDc.js → LogsSt-U1H0mP1m.js} +35 -5
- package/dist/LogsSt-U1H0mP1m.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/index.cjs +565 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +210 -31
- package/dist/index.d.ts +210 -31
- package/dist/index.js +561 -63
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-_nrvJYyt.js → run-serve-BeAznay5.js} +549 -43
- package/dist/run-serve-BeAznay5.js.map +1 -0
- package/dist/{run-tui-Atvf9vb3.js → run-tui-BTGjvnKk.js} +75 -18
- package/dist/run-tui-BTGjvnKk.js.map +1 -0
- package/dist/{DefinedWorkflow-BatWaZO1.js → schemaDrift-Cg39vs53.js} +644 -60
- package/dist/schemaDrift-Cg39vs53.js.map +1 -0
- package/dist/serve-web.js +523 -133
- package/dist/{state-6RFDIQwJ.js → state-C7REnHan.js} +18 -3
- package/dist/{state-6RFDIQwJ.js.map → state-C7REnHan.js.map} +1 -1
- package/dist/web.d.ts +210 -31
- package/dist/web.js +561 -63
- package/dist/web.js.map +1 -1
- package/examples/comfy-cloud/capybara-i2v.cflow.ts +2 -0
- package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +2 -0
- package/examples/comfy-cloud/wan22-i2v.cflow.ts +2 -0
- package/examples/comfy-cloud/wan22-t2v.cflow.ts +2 -0
- package/examples/rvion/06-qwen-image-edit.cflow.ts +3 -2
- package/examples/rvion/07-local-llm-text-gen.cflow.ts +2 -2
- package/examples/rvion/10-anima-t2i.cflow.ts +229 -0
- package/extra/README.md +4 -0
- package/extra/comfyui-fresh-model-lists/README.md +25 -0
- package/extra/comfyui-fresh-model-lists/__init__.py +36 -0
- package/extra/comfyui-fresh-model-lists/test_fresh_model_lists.py +97 -0
- package/package.json +17 -7
- package/src/cli/draftMeta.ts +39 -0
- package/src/cli/serve/ServeApp.ts +242 -12
- package/src/cli/serve/applyVarPayload.ts +50 -22
- package/src/cli/serve/describeVar.ts +49 -6
- package/src/cli/serve/favicon.ts +3 -0
- package/src/cli/serve/llmConfigShape.ts +51 -0
- package/src/cli/serve/llmConfigs.ts +52 -0
- package/src/cli/serve/tagList.ts +92 -0
- package/src/cli/serve/tagSource.ts +69 -0
- package/src/cli/serve/web/api.ts +60 -0
- package/src/cli/serve/web/components/App.tsx +336 -44
- package/src/cli/serve/web/components/Gallery.tsx +105 -28
- package/src/cli/serve/web/components/HistoryPicker.tsx +149 -0
- package/src/cli/serve/web/components/Icon.tsx +18 -2
- package/src/cli/serve/web/components/MenuButton.tsx +53 -0
- package/src/cli/serve/web/components/Omnibox.tsx +85 -0
- package/src/cli/serve/web/components/PromptEnhancer.tsx +476 -180
- package/src/cli/serve/web/components/TooltipLayer.tsx +45 -0
- package/src/cli/serve/web/components/VarIcon.tsx +24 -0
- package/src/cli/serve/web/components/VarsForm.tsx +341 -177
- package/src/cli/serve/web/components/controls/BasicControls.tsx +57 -32
- package/src/cli/serve/web/components/controls/LorasControl.tsx +708 -285
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +1 -1
- package/src/cli/serve/web/components/controls/PromptControl.tsx +279 -0
- package/src/cli/serve/web/components/controls/PromptEditor.tsx +113 -0
- package/src/cli/serve/web/components/controls/SeedControl.tsx +17 -10
- package/src/cli/serve/web/components/controls/SizeControl.tsx +111 -18
- package/src/cli/serve/web/components/modKey.ts +2 -0
- package/src/cli/serve/web/llm.ts +23 -12
- package/src/cli/serve/web/promptEditor/promptExtensions.ts +281 -0
- package/src/cli/serve/web/state/EnhancerSt.ts +415 -100
- package/src/cli/serve/web/state/FormSt.ts +193 -29
- package/src/cli/serve/web/state/OmniboxSt.ts +57 -0
- package/src/cli/serve/web/state/WebSt.ts +281 -57
- package/src/cli/serve/web/state/choiceButtons.ts +61 -0
- package/src/cli/serve/web/state/generateButton.ts +16 -0
- package/src/cli/serve/web/state/history.ts +54 -0
- package/src/cli/serve/web/state/host.ts +5 -2
- package/src/cli/serve/web/state/keptLines.ts +53 -0
- package/src/cli/serve/web/state/latentMode.ts +20 -0
- package/src/cli/serve/web/state/loraSort.ts +57 -0
- package/src/cli/serve/web/state/moduleTree.ts +2 -2
- package/src/cli/serve/web/state/omnibox.ts +69 -0
- package/src/cli/serve/web/state/payload.ts +38 -58
- package/src/cli/serve/web/state/shortcuts.ts +54 -0
- package/src/cli/serve/web/state/sizeStars.ts +31 -0
- package/src/cli/serve/web/state/stableSlots.ts +21 -0
- package/src/cli/serve/web/state/varGroups.ts +24 -0
- package/src/cli/serve/web/styles.ts +472 -118
- package/src/cli/serve/webBundle.ts +54 -10
- package/src/cli/tui/components/Header.tsx +2 -0
- package/src/cli/tui/components/PickerOverlays.tsx +9 -2
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +1 -1
- package/src/cli/tui/state/DraftsSt.ts +18 -2
- package/src/cli/tui/state/EditorSt.ts +1 -1
- package/src/cli/tui/state/HostSt.ts +34 -0
- package/src/cli/tui/state/LorasSt.ts +1 -1
- package/src/cli/tui/state/PickerSt.ts +25 -7
- package/src/cli/tui/state/SettingsSt.ts +1 -1
- package/src/cli/tui/state/TuiSt.ts +10 -0
- package/src/coreExports.ts +20 -0
- package/src/host/ComfyHost.ts +15 -0
- package/src/host/loraInfoCache.ts +70 -0
- package/src/host/loraManagerApi.ts +27 -0
- package/src/host/schemaDrift.ts +87 -0
- package/src/state.ts +5 -0
- package/src/vars/ComfyVars.ts +337 -67
- package/src/vars/DefinedWorkflow.ts +40 -19
- package/src/vars/lanes.ts +238 -0
- package/src/vars/loraEntry.ts +101 -0
- package/src/vars/promptSyntax.ts +382 -0
- package/dist/DefinedWorkflow-BatWaZO1.js.map +0 -1
- package/dist/LogsSt-DFxzQfDc.js.map +0 -1
- package/dist/run-serve-_nrvJYyt.js.map +0 -1
- package/dist/run-tui-Atvf9vb3.js.map +0 -1
- package/src/cli/serve/web/components/Sidebar.tsx +0 -66
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { isRecord } from 'src/utils/isRecord.ts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* what changed on a host since a schema was loaded: node types, and the model files each loader
|
|
5
|
+
* lists. ComfyUI exposes no boot time, so staleness is decided by CONTENT: a restart that changed
|
|
6
|
+
* nothing stays quiet, a new lora shows even when nobody knows when the box rebooted.
|
|
7
|
+
* A light check asks only the loaders (`/object_info/<node>`, a few KB); a full one compares every
|
|
8
|
+
* node type (`/object_info`, megabytes).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** the loader inputs whose combo IS a model folder listing */
|
|
12
|
+
export const MODEL_LISTS = [
|
|
13
|
+
{ noun: 'lora', node: 'LoraLoader', input: 'lora_name' },
|
|
14
|
+
{ noun: 'checkpoint', node: 'CheckpointLoaderSimple', input: 'ckpt_name' },
|
|
15
|
+
{ noun: 'unet', node: 'UNETLoader', input: 'unet_name' },
|
|
16
|
+
{ noun: 'text encoder', node: 'CLIPLoader', input: 'clip_name' },
|
|
17
|
+
{ noun: 'vae', node: 'VAELoader', input: 'vae_name' },
|
|
18
|
+
] as const
|
|
19
|
+
|
|
20
|
+
type Spec = Record<string, unknown>
|
|
21
|
+
type Delta = { added: string[]; removed: string[] }
|
|
22
|
+
|
|
23
|
+
export type SchemaDrift = {
|
|
24
|
+
/** null on a light check: node types are only compared by a full one */
|
|
25
|
+
nodes: Delta | null
|
|
26
|
+
models: ({ noun: string } & Delta)[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** a combo's options in both object_info spellings: `[[...options]]` and `['COMBO', { options }]` */
|
|
30
|
+
export function comboOptions(spec: Spec, node: string, input: string): string[] | null {
|
|
31
|
+
const def = spec[node]
|
|
32
|
+
if (!isRecord(def) || !isRecord(def['input'])) return null
|
|
33
|
+
const sections = def['input']
|
|
34
|
+
for (const section of ['required', 'optional']) {
|
|
35
|
+
const sec = sections[section]
|
|
36
|
+
if (!isRecord(sec)) continue
|
|
37
|
+
const slot = sec[input]
|
|
38
|
+
if (!Array.isArray(slot)) continue
|
|
39
|
+
const first: unknown = slot[0]
|
|
40
|
+
if (Array.isArray(first)) return first.filter((x): x is string => typeof x === 'string')
|
|
41
|
+
const opts: unknown = slot[1]
|
|
42
|
+
if (first === 'COMBO' && isRecord(opts) && Array.isArray(opts['options']))
|
|
43
|
+
return opts['options'].filter((x): x is string => typeof x === 'string')
|
|
44
|
+
}
|
|
45
|
+
return null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function delta(before: readonly string[], after: readonly string[]): Delta {
|
|
49
|
+
const was = new Set(before)
|
|
50
|
+
const now = new Set(after)
|
|
51
|
+
return { added: after.filter((x) => !was.has(x)), removed: before.filter((x) => !now.has(x)) }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** `live` may be PARTIAL (a light check holds only the loaders): a list is compared only where both
|
|
55
|
+
* sides have the loader, and node types only when `full` */
|
|
56
|
+
export function diffSchemas(p: { loaded: Spec; live: Spec; full: boolean }): SchemaDrift {
|
|
57
|
+
const models: SchemaDrift['models'] = []
|
|
58
|
+
for (const m of MODEL_LISTS) {
|
|
59
|
+
const before = comboOptions(p.loaded, m.node, m.input)
|
|
60
|
+
const after = comboOptions(p.live, m.node, m.input)
|
|
61
|
+
if (before == null || after == null) continue
|
|
62
|
+
const d = delta(before, after)
|
|
63
|
+
if (d.added.length > 0 || d.removed.length > 0) models.push({ noun: m.noun, ...d })
|
|
64
|
+
}
|
|
65
|
+
return { nodes: p.full ? delta(Object.keys(p.loaded), Object.keys(p.live)) : null, models }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function driftChanged(d: SchemaDrift): boolean {
|
|
69
|
+
return d.models.length > 0 || (d.nodes != null && (d.nodes.added.length > 0 || d.nodes.removed.length > 0))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** `+5 loras, -1 unet, +4 node types`, '' when nothing changed */
|
|
73
|
+
export function summarizeDrift(d: SchemaDrift): string {
|
|
74
|
+
const parts: string[] = []
|
|
75
|
+
const say = (n: number, sign: string, noun: string): void => {
|
|
76
|
+
if (n > 0) parts.push(`${sign}${n} ${noun}${n === 1 ? '' : 's'}`)
|
|
77
|
+
}
|
|
78
|
+
for (const m of d.models) {
|
|
79
|
+
say(m.added.length, '+', m.noun)
|
|
80
|
+
say(m.removed.length, '-', m.noun)
|
|
81
|
+
}
|
|
82
|
+
if (d.nodes != null) {
|
|
83
|
+
say(d.nodes.added.length, '+', 'node type')
|
|
84
|
+
say(d.nodes.removed.length, '-', 'node type')
|
|
85
|
+
}
|
|
86
|
+
return parts.join(', ')
|
|
87
|
+
}
|
package/src/state.ts
CHANGED
|
@@ -110,6 +110,11 @@ export class ComfyTS {
|
|
|
110
110
|
return asAbsolutePath(join(this.baseFolder, 'prompt-enhancers', relativePath))
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/** the serve web ui's LLM configs (prompt enhancer), one json per config */
|
|
114
|
+
resolveFromLlmConfigs(relativePath: string): AbsolutePath {
|
|
115
|
+
return asAbsolutePath(join(this.baseFolder, 'llm-configs', relativePath))
|
|
116
|
+
}
|
|
117
|
+
|
|
113
118
|
resolveFromCache(relativePath: string): AbsolutePath {
|
|
114
119
|
return asAbsolutePath(join(this.baseFolder, 'cache', relativePath))
|
|
115
120
|
}
|