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.
Files changed (110) hide show
  1. package/README.md +1 -0
  2. package/dist/{LogsSt-DFxzQfDc.js → LogsSt-U1H0mP1m.js} +35 -5
  3. package/dist/LogsSt-U1H0mP1m.js.map +1 -0
  4. package/dist/cli.js +4 -4
  5. package/dist/index.cjs +565 -62
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +210 -31
  8. package/dist/index.d.ts +210 -31
  9. package/dist/index.js +561 -63
  10. package/dist/index.js.map +1 -1
  11. package/dist/{run-serve-_nrvJYyt.js → run-serve-BeAznay5.js} +549 -43
  12. package/dist/run-serve-BeAznay5.js.map +1 -0
  13. package/dist/{run-tui-Atvf9vb3.js → run-tui-BTGjvnKk.js} +75 -18
  14. package/dist/run-tui-BTGjvnKk.js.map +1 -0
  15. package/dist/{DefinedWorkflow-BatWaZO1.js → schemaDrift-Cg39vs53.js} +644 -60
  16. package/dist/schemaDrift-Cg39vs53.js.map +1 -0
  17. package/dist/serve-web.js +523 -133
  18. package/dist/{state-6RFDIQwJ.js → state-C7REnHan.js} +18 -3
  19. package/dist/{state-6RFDIQwJ.js.map → state-C7REnHan.js.map} +1 -1
  20. package/dist/web.d.ts +210 -31
  21. package/dist/web.js +561 -63
  22. package/dist/web.js.map +1 -1
  23. package/examples/comfy-cloud/capybara-i2v.cflow.ts +2 -0
  24. package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +2 -0
  25. package/examples/comfy-cloud/wan22-i2v.cflow.ts +2 -0
  26. package/examples/comfy-cloud/wan22-t2v.cflow.ts +2 -0
  27. package/examples/rvion/06-qwen-image-edit.cflow.ts +3 -2
  28. package/examples/rvion/07-local-llm-text-gen.cflow.ts +2 -2
  29. package/examples/rvion/10-anima-t2i.cflow.ts +229 -0
  30. package/extra/README.md +4 -0
  31. package/extra/comfyui-fresh-model-lists/README.md +25 -0
  32. package/extra/comfyui-fresh-model-lists/__init__.py +36 -0
  33. package/extra/comfyui-fresh-model-lists/test_fresh_model_lists.py +97 -0
  34. package/package.json +17 -7
  35. package/src/cli/draftMeta.ts +39 -0
  36. package/src/cli/serve/ServeApp.ts +242 -12
  37. package/src/cli/serve/applyVarPayload.ts +50 -22
  38. package/src/cli/serve/describeVar.ts +49 -6
  39. package/src/cli/serve/favicon.ts +3 -0
  40. package/src/cli/serve/llmConfigShape.ts +51 -0
  41. package/src/cli/serve/llmConfigs.ts +52 -0
  42. package/src/cli/serve/tagList.ts +92 -0
  43. package/src/cli/serve/tagSource.ts +69 -0
  44. package/src/cli/serve/web/api.ts +60 -0
  45. package/src/cli/serve/web/components/App.tsx +336 -44
  46. package/src/cli/serve/web/components/Gallery.tsx +105 -28
  47. package/src/cli/serve/web/components/HistoryPicker.tsx +149 -0
  48. package/src/cli/serve/web/components/Icon.tsx +18 -2
  49. package/src/cli/serve/web/components/MenuButton.tsx +53 -0
  50. package/src/cli/serve/web/components/Omnibox.tsx +85 -0
  51. package/src/cli/serve/web/components/PromptEnhancer.tsx +476 -180
  52. package/src/cli/serve/web/components/TooltipLayer.tsx +45 -0
  53. package/src/cli/serve/web/components/VarIcon.tsx +24 -0
  54. package/src/cli/serve/web/components/VarsForm.tsx +341 -177
  55. package/src/cli/serve/web/components/controls/BasicControls.tsx +57 -32
  56. package/src/cli/serve/web/components/controls/LorasControl.tsx +708 -285
  57. package/src/cli/serve/web/components/controls/PresetPicker.tsx +1 -1
  58. package/src/cli/serve/web/components/controls/PromptControl.tsx +279 -0
  59. package/src/cli/serve/web/components/controls/PromptEditor.tsx +113 -0
  60. package/src/cli/serve/web/components/controls/SeedControl.tsx +17 -10
  61. package/src/cli/serve/web/components/controls/SizeControl.tsx +111 -18
  62. package/src/cli/serve/web/components/modKey.ts +2 -0
  63. package/src/cli/serve/web/llm.ts +23 -12
  64. package/src/cli/serve/web/promptEditor/promptExtensions.ts +281 -0
  65. package/src/cli/serve/web/state/EnhancerSt.ts +415 -100
  66. package/src/cli/serve/web/state/FormSt.ts +193 -29
  67. package/src/cli/serve/web/state/OmniboxSt.ts +57 -0
  68. package/src/cli/serve/web/state/WebSt.ts +281 -57
  69. package/src/cli/serve/web/state/choiceButtons.ts +61 -0
  70. package/src/cli/serve/web/state/generateButton.ts +16 -0
  71. package/src/cli/serve/web/state/history.ts +54 -0
  72. package/src/cli/serve/web/state/host.ts +5 -2
  73. package/src/cli/serve/web/state/keptLines.ts +53 -0
  74. package/src/cli/serve/web/state/latentMode.ts +20 -0
  75. package/src/cli/serve/web/state/loraSort.ts +57 -0
  76. package/src/cli/serve/web/state/moduleTree.ts +2 -2
  77. package/src/cli/serve/web/state/omnibox.ts +69 -0
  78. package/src/cli/serve/web/state/payload.ts +38 -58
  79. package/src/cli/serve/web/state/shortcuts.ts +54 -0
  80. package/src/cli/serve/web/state/sizeStars.ts +31 -0
  81. package/src/cli/serve/web/state/stableSlots.ts +21 -0
  82. package/src/cli/serve/web/state/varGroups.ts +24 -0
  83. package/src/cli/serve/web/styles.ts +472 -118
  84. package/src/cli/serve/webBundle.ts +54 -10
  85. package/src/cli/tui/components/Header.tsx +2 -0
  86. package/src/cli/tui/components/PickerOverlays.tsx +9 -2
  87. package/src/cli/tui/imagePicker/ImagePickerSt.ts +1 -1
  88. package/src/cli/tui/state/DraftsSt.ts +18 -2
  89. package/src/cli/tui/state/EditorSt.ts +1 -1
  90. package/src/cli/tui/state/HostSt.ts +34 -0
  91. package/src/cli/tui/state/LorasSt.ts +1 -1
  92. package/src/cli/tui/state/PickerSt.ts +25 -7
  93. package/src/cli/tui/state/SettingsSt.ts +1 -1
  94. package/src/cli/tui/state/TuiSt.ts +10 -0
  95. package/src/coreExports.ts +20 -0
  96. package/src/host/ComfyHost.ts +15 -0
  97. package/src/host/loraInfoCache.ts +70 -0
  98. package/src/host/loraManagerApi.ts +27 -0
  99. package/src/host/schemaDrift.ts +87 -0
  100. package/src/state.ts +5 -0
  101. package/src/vars/ComfyVars.ts +337 -67
  102. package/src/vars/DefinedWorkflow.ts +40 -19
  103. package/src/vars/lanes.ts +238 -0
  104. package/src/vars/loraEntry.ts +101 -0
  105. package/src/vars/promptSyntax.ts +382 -0
  106. package/dist/DefinedWorkflow-BatWaZO1.js.map +0 -1
  107. package/dist/LogsSt-DFxzQfDc.js.map +0 -1
  108. package/dist/run-serve-_nrvJYyt.js.map +0 -1
  109. package/dist/run-tui-Atvf9vb3.js.map +0 -1
  110. package/src/cli/serve/web/components/Sidebar.tsx +0 -66
@@ -0,0 +1,149 @@
1
+ // the history picker: every value submitted this page, searchable. Two columns: the matches on
2
+ // the left (first line, how long ago, where from), the FULL text of the highlighted one on the
3
+ // right, so arrowing down previews exactly what a pick writes. Enter or a click picks
4
+ import { useEffect, useRef, useState, type ReactNode } from 'react'
5
+ import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
6
+ import { searchHistory, timeAgo, type HistoryEntry } from 'src/cli/serve/web/state/history.ts'
7
+
8
+ /** the button that opens it: always there, disabled while nothing was submitted yet. Plain (not
9
+ * an observer) to stay generic: the observer parent reads the list and passes it down */
10
+ export function HistoryButton<V>(p: {
11
+ entries: readonly HistoryEntry<V>[]
12
+ what: string
13
+ onPick(entry: HistoryEntry<V>): void
14
+ compact?: boolean
15
+ }): ReactNode {
16
+ const [open, setOpen] = useState(false)
17
+ const n = p.entries.length
18
+ return (
19
+ <>
20
+ <button
21
+ type="button"
22
+ className={p.compact === true ? 'link' : 'mini'}
23
+ disabled={n === 0}
24
+ data-tip={
25
+ n === 0
26
+ ? `every ${p.what} you submit shows here, until you close the page`
27
+ : `${n} past ${p.what}s: search, preview, restore`
28
+ }
29
+ onClick={() => setOpen(true)}
30
+ >
31
+ <Icon name="history" />
32
+ {p.compact === true ? null : ' history'}
33
+ </button>
34
+ {open ? (
35
+ <HistoryPicker
36
+ entries={p.entries}
37
+ what={p.what}
38
+ onPick={(e) => {
39
+ setOpen(false)
40
+ p.onPick(e)
41
+ }}
42
+ onClose={() => setOpen(false)}
43
+ />
44
+ ) : null}
45
+ </>
46
+ )
47
+ }
48
+
49
+ function HistoryPicker<V>(p: {
50
+ entries: readonly HistoryEntry<V>[]
51
+ what: string
52
+ onPick(entry: HistoryEntry<V>): void
53
+ onClose(): void
54
+ }): ReactNode {
55
+ const [query, setQuery] = useState('')
56
+ const [cursor, setCursor] = useState(0)
57
+ const [now, setNow] = useState(() => Date.now())
58
+ const listRef = useRef<HTMLDivElement>(null)
59
+ const matches = searchHistory(p.entries, query)
60
+ const sel = matches[Math.min(cursor, Math.max(0, matches.length - 1))] ?? null
61
+ // "3 min ago" keeps being true while the picker stays open
62
+ useEffect(() => {
63
+ const t = setInterval(() => setNow(Date.now()), 10_000)
64
+ return () => clearInterval(t)
65
+ }, [])
66
+ // esc closes THIS, never the modal under it (the enhancer listens on window too): a capture
67
+ // listener runs first and stops the event there
68
+ useEffect(() => {
69
+ const onKey = (e: KeyboardEvent): void => {
70
+ if (e.key !== 'Escape') return
71
+ e.stopImmediatePropagation()
72
+ p.onClose()
73
+ }
74
+ window.addEventListener('keydown', onKey, true)
75
+ return () => window.removeEventListener('keydown', onKey, true)
76
+ }, [p])
77
+ useEffect(() => {
78
+ listRef.current?.querySelector('.hist-row.sel')?.scrollIntoView({ block: 'nearest' })
79
+ }, [cursor, query])
80
+ const move = (delta: number): void => setCursor((c) => Math.max(0, Math.min(matches.length - 1, c + delta)))
81
+ return (
82
+ <div className="modal-overlay top hist-overlay" onClick={() => p.onClose()}>
83
+ <div className="modal hist-modal" onClick={(e) => e.stopPropagation()}>
84
+ <div className="modal-head">
85
+ <Icon name="history" />
86
+ <input
87
+ type="text"
88
+ autoFocus
89
+ placeholder={`search ${p.entries.length} past ${p.what}s, every word must match`}
90
+ value={query}
91
+ onChange={(e) => {
92
+ setQuery(e.target.value)
93
+ setCursor(0)
94
+ }}
95
+ onKeyDown={(e) => {
96
+ if (e.key === 'ArrowDown') {
97
+ e.preventDefault()
98
+ move(1)
99
+ } else if (e.key === 'ArrowUp') {
100
+ e.preventDefault()
101
+ move(-1)
102
+ } else if (e.key === 'Enter') {
103
+ e.preventDefault()
104
+ if (sel != null) p.onPick(sel)
105
+ }
106
+ }}
107
+ />
108
+ <button type="button" className="modal-close" data-tip="close (esc)" onClick={() => p.onClose()}>
109
+ <Icon name="close" />
110
+ </button>
111
+ </div>
112
+ <div className="hist-cols">
113
+ <div className="hist-list" ref={listRef}>
114
+ {matches.length === 0 ? <div className="hist-empty">nothing matches '{query}'</div> : null}
115
+ {matches.map((e, ix) => (
116
+ <button
117
+ key={e.text}
118
+ type="button"
119
+ className={e === sel ? 'hist-row sel' : 'hist-row'}
120
+ onMouseEnter={() => setCursor(ix)}
121
+ onClick={() => p.onPick(e)}
122
+ >
123
+ <span className="hist-first">{e.text.split('\n')[0]}</span>
124
+ <span className="hist-meta">
125
+ {timeAgo(e.at, now)}
126
+ {e.count > 1 ? ` · ${e.count}×` : ''}
127
+ {e.source === '' ? '' : ` · ${e.source}`}
128
+ </span>
129
+ </button>
130
+ ))}
131
+ </div>
132
+ <div className="hist-preview">
133
+ {sel == null ? null : (
134
+ <>
135
+ <pre className="hist-text">{sel.text}</pre>
136
+ <div className="hist-foot">
137
+ <span className="hint">↑↓ to preview, enter or click to restore</span>
138
+ <button type="button" className="primary" onClick={() => p.onPick(sel)}>
139
+ restore this {p.what}
140
+ </button>
141
+ </div>
142
+ </>
143
+ )}
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </div>
148
+ )
149
+ }
@@ -36,7 +36,14 @@ export type IconName =
36
36
  | 'unlink'
37
37
  | 'refresh'
38
38
  | 'terminal'
39
- | 'folder'
39
+ | 'search'
40
+ | 'history'
41
+ | 'rows'
42
+ | 'grid'
43
+ | 'eye'
44
+ | 'eye-off'
45
+ | 'more'
46
+ | 'text'
40
47
  | 'dot'
41
48
 
42
49
  /** 24x24 viewBox paths, stroked (fill: none) unless the shape reads better solid */
@@ -133,7 +140,16 @@ const PATHS: Record<IconName, ReactNode> = {
133
140
  ),
134
141
  refresh: <path d="M20 11a8 8 0 10-2 6M20 6v5h-5" />,
135
142
  terminal: <path d="M4 5h16v14H4zM7 9l3 3-3 3M13 15h4" />,
136
- folder: <path d="M3 7h6l2 2h10v10H3z" />,
143
+ text: <path d="M4 7h16M4 12h10M4 17h13" />,
144
+ more: <path d="M5 12h.01M12 12h.01M19 12h.01" strokeWidth={3.2} />,
145
+ eye: <path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zM12 9a3 3 0 110 6 3 3 0 010-6z" />,
146
+ 'eye-off': (
147
+ <path d="M3 3l18 18M10.6 5.1A10 10 0 0112 5c6.5 0 10 7 10 7a17 17 0 01-3.2 4.2M6.6 6.6C3.9 8.4 2 12 2 12s3.5 7 10 7a9.7 9.7 0 005.4-1.6M9.9 9.9a3 3 0 004.2 4.2" />
148
+ ),
149
+ rows: <path d="M4 5h16v6H4zM4 13h16v6H4z" />,
150
+ grid: <path d="M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z" />,
151
+ search: <path d="M10.5 4a6.5 6.5 0 110 13 6.5 6.5 0 010-13zM15.5 15.5L20 20" />,
152
+ history: <path d="M4 12a8 8 0 102.3-5.6M4 4v4h4M12 8v4l3 2" />,
137
153
  dot: <circle cx="12" cy="12" r="5" fill="currentColor" stroke="none" />,
138
154
  }
139
155
 
@@ -0,0 +1,53 @@
1
+ // a ⋯ button and the small menu it opens: where the rarely used actions go, so a row shows its
2
+ // content instead of a strip of buttons. A backdrop under the menu closes it on any outside
3
+ // click, no document listener to leak
4
+ import { useState, type ReactNode } from 'react'
5
+ import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
6
+
7
+ export function MenuButton(p: {
8
+ tip: string
9
+ className?: string
10
+ /** the menu body; `close` is handed over so an item can shut the menu after acting */
11
+ children: (close: () => void) => ReactNode
12
+ }): ReactNode {
13
+ const [open, setOpen] = useState(false)
14
+ const close = (): void => setOpen(false)
15
+ return (
16
+ <span
17
+ className={`preset-box menu-box ${p.className ?? ''}`}
18
+ onKeyDown={(e) => (e.key === 'Escape' ? close() : undefined)}
19
+ >
20
+ <button
21
+ type="button"
22
+ className="menu-btn"
23
+ aria-expanded={open}
24
+ data-tip={p.tip}
25
+ onClick={() => setOpen(!open)}
26
+ >
27
+ <Icon name="more" />
28
+ </button>
29
+ {open ? (
30
+ <>
31
+ <div className="preset-backdrop" onClick={close} />
32
+ <div className="preset-menu menu-list">{p.children(close)}</div>
33
+ </>
34
+ ) : null}
35
+ </span>
36
+ )
37
+ }
38
+
39
+ /** one menu line: a button, or a checkbox line when `checked` is given */
40
+ export function MenuItem(p: {
41
+ label: ReactNode
42
+ onClick: () => void
43
+ checked?: boolean
44
+ disabled?: boolean
45
+ tip?: string
46
+ }): ReactNode {
47
+ return (
48
+ <button type="button" className="menu-item" disabled={p.disabled} data-tip={p.tip} onClick={p.onClick}>
49
+ <span className="menu-check">{p.checked == null ? '' : p.checked ? '✓' : ''}</span>
50
+ {p.label}
51
+ </button>
52
+ )
53
+ }
@@ -0,0 +1,85 @@
1
+ // ⌘K / ⌘J: type a few letters of any folder, workflow or draft, Enter opens it.
2
+ // modules that failed to load are listed under the matches, since nothing else shows them
3
+ import { observer } from 'mobx-react-lite'
4
+ import { useEffect, useRef } from 'react'
5
+ import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
6
+
7
+ /** ⌘K and ⌘J (ctrl on other systems) from ANY focus, a text field included: it is a jump,
8
+ * not an edit, and the prompt textarea is where the focus usually is */
9
+ export function useOmniboxShortcut(st: WebSt): void {
10
+ useEffect(() => {
11
+ const onKey = (e: KeyboardEvent): void => {
12
+ if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey) return
13
+ if (e.key !== 'k' && e.key !== 'K' && e.key !== 'j' && e.key !== 'J') return
14
+ e.preventDefault()
15
+ st.omnibox.toggle()
16
+ }
17
+ window.addEventListener('keydown', onKey)
18
+ return () => window.removeEventListener('keydown', onKey)
19
+ }, [st])
20
+ }
21
+
22
+ export const Omnibox = observer(function Omnibox(p: { st: WebSt }) {
23
+ const o = p.st.omnibox
24
+ const listRef = useRef<HTMLDivElement>(null)
25
+ // the lit row stays in view while arrowing through a long list
26
+ useEffect(() => {
27
+ listRef.current?.querySelector('.omni-row.sel')?.scrollIntoView({ block: 'nearest' })
28
+ }, [o.cursor, o.query])
29
+ if (!o.isOpen) return null
30
+ const results = o.results
31
+ const errors = Object.entries(p.st.loadErrors)
32
+ const current = p.st.form
33
+ return (
34
+ <div className="modal-overlay omni-overlay" onClick={() => o.close()}>
35
+ <div className="modal omni" onClick={(e) => e.stopPropagation()}>
36
+ <div className="modal-head">
37
+ <input
38
+ type="text"
39
+ autoFocus
40
+ placeholder="workflow or draft…"
41
+ value={o.query}
42
+ onChange={(e) => o.setQuery(e.target.value)}
43
+ onKeyDown={(e) => {
44
+ if (e.key === 'ArrowDown') o.move(1)
45
+ else if (e.key === 'ArrowUp') o.move(-1)
46
+ else if (e.key === 'Enter') o.pick()
47
+ else if (e.key === 'Escape') o.close()
48
+ else return
49
+ e.preventDefault()
50
+ }}
51
+ />
52
+ </div>
53
+ <div className="modal-body omni-list" ref={listRef}>
54
+ {results.length === 0 ? <div className="hint">no workflow or draft matches</div> : null}
55
+ {results.map((entry, ix) => {
56
+ const open = current?.moduleKey === entry.module && current.draft === entry.draft
57
+ const cls = ['omni-row', ix === o.cursor ? 'sel' : '', open ? 'open' : ''].join(' ')
58
+ return (
59
+ <button
60
+ key={`${entry.module}/${entry.draft}`}
61
+ type="button"
62
+ className={cls}
63
+ onClick={() => o.pick(entry)}
64
+ >
65
+ <span className="omni-label">{entry.label}</span>
66
+ <span className="omni-host">{open ? 'open' : entry.host}</span>
67
+ </button>
68
+ )
69
+ })}
70
+ {errors.length > 0 ? (
71
+ <div className="omni-errors">
72
+ <div className="section-title">failed to load</div>
73
+ {errors.map(([file, msg]) => (
74
+ <div key={file}>
75
+ <div className="file">{file}</div>
76
+ <div className="msg">{msg}</div>
77
+ </div>
78
+ ))}
79
+ </div>
80
+ ) : null}
81
+ </div>
82
+ </div>
83
+ </div>
84
+ )
85
+ })