comfy-ts 2.11.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 (99) hide show
  1. package/README.md +1 -0
  2. package/dist/{LogsSt-qtFzOKpu.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 +473 -62
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +191 -31
  8. package/dist/index.d.ts +191 -31
  9. package/dist/index.js +469 -63
  10. package/dist/index.js.map +1 -1
  11. package/dist/{run-serve-BK7BA2dn.js → run-serve-BeAznay5.js} +461 -43
  12. package/dist/run-serve-BeAznay5.js.map +1 -0
  13. package/dist/{run-tui-CQyvMf0N.js → run-tui-BTGjvnKk.js} +43 -18
  14. package/dist/run-tui-BTGjvnKk.js.map +1 -0
  15. package/dist/{schemaDrift-DjjEtwfx.js → schemaDrift-Cg39vs53.js} +470 -60
  16. package/dist/schemaDrift-Cg39vs53.js.map +1 -0
  17. package/dist/serve-web.js +508 -134
  18. package/dist/{state--wrz0BQc.js → state-C7REnHan.js} +7 -3
  19. package/dist/{state--wrz0BQc.js.map → state-C7REnHan.js.map} +1 -1
  20. package/dist/web.d.ts +191 -31
  21. package/dist/web.js +469 -63
  22. package/dist/web.js.map +1 -1
  23. package/examples/rvion/06-qwen-image-edit.cflow.ts +3 -2
  24. package/examples/rvion/10-anima-t2i.cflow.ts +229 -0
  25. package/extra/README.md +4 -0
  26. package/extra/comfyui-fresh-model-lists/README.md +25 -0
  27. package/extra/comfyui-fresh-model-lists/__init__.py +36 -0
  28. package/extra/comfyui-fresh-model-lists/test_fresh_model_lists.py +97 -0
  29. package/package.json +15 -7
  30. package/src/cli/draftMeta.ts +39 -0
  31. package/src/cli/serve/ServeApp.ts +148 -12
  32. package/src/cli/serve/applyVarPayload.ts +50 -22
  33. package/src/cli/serve/describeVar.ts +42 -6
  34. package/src/cli/serve/llmConfigShape.ts +51 -0
  35. package/src/cli/serve/llmConfigs.ts +52 -0
  36. package/src/cli/serve/tagList.ts +92 -0
  37. package/src/cli/serve/tagSource.ts +69 -0
  38. package/src/cli/serve/web/api.ts +48 -0
  39. package/src/cli/serve/web/components/App.tsx +336 -44
  40. package/src/cli/serve/web/components/Gallery.tsx +105 -28
  41. package/src/cli/serve/web/components/HistoryPicker.tsx +149 -0
  42. package/src/cli/serve/web/components/Icon.tsx +18 -2
  43. package/src/cli/serve/web/components/MenuButton.tsx +53 -0
  44. package/src/cli/serve/web/components/Omnibox.tsx +85 -0
  45. package/src/cli/serve/web/components/PromptEnhancer.tsx +476 -180
  46. package/src/cli/serve/web/components/TooltipLayer.tsx +45 -0
  47. package/src/cli/serve/web/components/VarIcon.tsx +24 -0
  48. package/src/cli/serve/web/components/VarsForm.tsx +341 -188
  49. package/src/cli/serve/web/components/controls/BasicControls.tsx +57 -32
  50. package/src/cli/serve/web/components/controls/LorasControl.tsx +644 -317
  51. package/src/cli/serve/web/components/controls/PresetPicker.tsx +1 -1
  52. package/src/cli/serve/web/components/controls/PromptControl.tsx +279 -0
  53. package/src/cli/serve/web/components/controls/PromptEditor.tsx +113 -0
  54. package/src/cli/serve/web/components/controls/SeedControl.tsx +17 -10
  55. package/src/cli/serve/web/components/controls/SizeControl.tsx +111 -18
  56. package/src/cli/serve/web/components/modKey.ts +2 -0
  57. package/src/cli/serve/web/llm.ts +23 -12
  58. package/src/cli/serve/web/promptEditor/promptExtensions.ts +281 -0
  59. package/src/cli/serve/web/state/EnhancerSt.ts +415 -100
  60. package/src/cli/serve/web/state/FormSt.ts +193 -29
  61. package/src/cli/serve/web/state/OmniboxSt.ts +57 -0
  62. package/src/cli/serve/web/state/WebSt.ts +219 -74
  63. package/src/cli/serve/web/state/choiceButtons.ts +61 -0
  64. package/src/cli/serve/web/state/generateButton.ts +16 -0
  65. package/src/cli/serve/web/state/history.ts +54 -0
  66. package/src/cli/serve/web/state/host.ts +5 -2
  67. package/src/cli/serve/web/state/keptLines.ts +53 -0
  68. package/src/cli/serve/web/state/latentMode.ts +20 -0
  69. package/src/cli/serve/web/state/loraSort.ts +18 -0
  70. package/src/cli/serve/web/state/moduleTree.ts +2 -2
  71. package/src/cli/serve/web/state/omnibox.ts +69 -0
  72. package/src/cli/serve/web/state/payload.ts +38 -58
  73. package/src/cli/serve/web/state/shortcuts.ts +54 -0
  74. package/src/cli/serve/web/state/sizeStars.ts +31 -0
  75. package/src/cli/serve/web/state/stableSlots.ts +21 -0
  76. package/src/cli/serve/web/state/varGroups.ts +24 -0
  77. package/src/cli/serve/web/styles.ts +457 -118
  78. package/src/cli/serve/webBundle.ts +54 -10
  79. package/src/cli/tui/components/PickerOverlays.tsx +9 -2
  80. package/src/cli/tui/imagePicker/ImagePickerSt.ts +1 -1
  81. package/src/cli/tui/state/DraftsSt.ts +18 -2
  82. package/src/cli/tui/state/EditorSt.ts +1 -1
  83. package/src/cli/tui/state/LorasSt.ts +1 -1
  84. package/src/cli/tui/state/PickerSt.ts +25 -7
  85. package/src/cli/tui/state/SettingsSt.ts +1 -1
  86. package/src/cli/tui/state/TuiSt.ts +10 -0
  87. package/src/coreExports.ts +20 -0
  88. package/src/host/loraInfoCache.ts +6 -0
  89. package/src/state.ts +5 -0
  90. package/src/vars/ComfyVars.ts +337 -67
  91. package/src/vars/DefinedWorkflow.ts +40 -19
  92. package/src/vars/lanes.ts +238 -0
  93. package/src/vars/loraEntry.ts +101 -0
  94. package/src/vars/promptSyntax.ts +382 -0
  95. package/dist/LogsSt-qtFzOKpu.js.map +0 -1
  96. package/dist/run-serve-BK7BA2dn.js.map +0 -1
  97. package/dist/run-tui-CQyvMf0N.js.map +0 -1
  98. package/dist/schemaDrift-DjjEtwfx.js.map +0 -1
  99. package/src/cli/serve/web/components/Sidebar.tsx +0 -66
@@ -1,26 +1,39 @@
1
1
  // the var rows: each kind dispatches to its matching control (the point of the
2
2
  // web ui — architecture item 12) + the sticky run bar
3
3
  import { observer, useLocalObservable } from 'mobx-react-lite'
4
- import { useEffect } from 'react'
4
+ import { useEffect, useRef, type ReactNode } from 'react'
5
+ import { MOD_KEY } from 'src/cli/serve/web/components/modKey.ts'
6
+ import { runChipText } from 'src/cli/serve/web/state/stableSlots.ts'
7
+ import { jumpTargets, SHORTCUT_KEYS, shortcutOf } from 'src/cli/serve/web/state/shortcuts.ts'
8
+ import { isPromptLanes } from 'src/vars/lanes.ts'
5
9
  import {
6
10
  ChoiceControl,
7
11
  NumberControl,
8
- PromptControl,
9
12
  TextControl,
10
13
  ToggleControl,
11
14
  } from 'src/cli/serve/web/components/controls/BasicControls.tsx'
15
+ import { PromptControl } from 'src/cli/serve/web/components/controls/PromptControl.tsx'
12
16
  import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
17
+ import { VarIcon } from 'src/cli/serve/web/components/VarIcon.tsx'
18
+ import { generateButtonLook } from 'src/cli/serve/web/state/generateButton.ts'
19
+ import { groupPlaces, type GroupPlace } from 'src/cli/serve/web/state/varGroups.ts'
13
20
  import { ImageControl } from 'src/cli/serve/web/components/controls/ImageControl.tsx'
14
21
  import { LorasControl } from 'src/cli/serve/web/components/controls/LorasControl.tsx'
15
22
  import { SeedControl } from 'src/cli/serve/web/components/controls/SeedControl.tsx'
16
23
  import { SizeControl } from 'src/cli/serve/web/components/controls/SizeControl.tsx'
17
24
  import type { FormSt, VarSt } from 'src/cli/serve/web/state/FormSt.ts'
18
- import { LAYOUTS, type WebSt } from 'src/cli/serve/web/state/WebSt.ts'
25
+ import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
19
26
 
20
- const VarControl = observer(function VarControl(p: { v: VarSt; host: string; st: WebSt; module: string }) {
27
+ const VarControl = observer(function VarControl(p: {
28
+ v: VarSt
29
+ host: string
30
+ st: WebSt
31
+ module: string
32
+ jumpTarget: boolean
33
+ }) {
21
34
  switch (p.v.desc.kind) {
22
35
  case 'prompt':
23
- return <PromptControl v={p.v} st={p.st} module={p.module} />
36
+ return <PromptControl v={p.v} st={p.st} module={p.module} jumpTarget={p.jumpTarget} />
24
37
  case 'text':
25
38
  return <TextControl v={p.v} />
26
39
  case 'int':
@@ -36,9 +49,17 @@ const VarControl = observer(function VarControl(p: { v: VarSt; host: string; st:
36
49
  // the OVERRIDE host, like every other host-scoped read: with `host` fixed at form
37
50
  // construction the previews, trigger words and details sheet came from the workflow's
38
51
  // own box while the manager link opened the one actually selected
39
- return <LorasControl v={p.v} host={p.st.hostFor(p.module)} st={p.st} hostUrl={p.st.hostUrlFor(p.module)} />
52
+ return (
53
+ <LorasControl
54
+ v={p.v}
55
+ host={p.st.hostFor(p.module)}
56
+ st={p.st}
57
+ hostUrl={p.st.hostUrlFor(p.module)}
58
+ jumpTarget={p.jumpTarget}
59
+ />
60
+ )
40
61
  case 'size':
41
- return <SizeControl v={p.v} />
62
+ return <SizeControl v={p.v} st={p.st} module={p.module} />
42
63
  case 'image':
43
64
  return <ImageControl v={p.v} />
44
65
  default:
@@ -54,12 +75,36 @@ const VarRow = observer(function VarRow(p: {
54
75
  module: string
55
76
  index: number
56
77
  names: readonly string[]
78
+ /** where this row sits in a block of vars that go together, null outside any */
79
+ place: GroupPlace
80
+ /** the ⌘ key that jumps here (first prompt, first loras), null for every other var */
81
+ jumpKey: string | null
57
82
  }) {
83
+ const rowRef = useRef<HTMLDivElement>(null)
84
+ const jump = p.st.jump
85
+ const jumpKind = p.jumpKey == null ? null : p.v.desc.kind
86
+ useEffect(() => {
87
+ if (jump == null || jumpKind !== 'prompt' || jump.kind !== 'prompt') return
88
+ const editor = rowRef.current?.querySelector<HTMLElement>('.cm-content')
89
+ editor?.focus()
90
+ editor?.scrollIntoView({ block: 'nearest' })
91
+ }, [jump, jumpKind])
92
+ // the workflow's looks (VarUi): every slot optional, absent = the panel's own style. None
93
+ // of them moves anything: a background or a border never shifts the label off its column
94
+ const ui = p.v.desc.ui
95
+ const inactive = p.st.form?.inactiveReason(p.v) ?? null
96
+ const wide = p.v.desc.kind === 'loras' || p.v.desc.kind === 'prompt'
58
97
  return (
59
98
  <div
99
+ ref={rowRef}
60
100
  /* loras and prompts need the whole width on a phone; every other kind keeps its
61
101
  label beside the control, which is what makes the form readable at a glance */
62
- className={p.v.desc.kind === 'loras' || p.v.desc.kind === 'prompt' ? 'var-row wide' : 'var-row'}
102
+ className={`var-row${wide ? ' wide' : ''}${inactive == null ? '' : ' inactive'}${p.place == null ? '' : ` in-group group-${p.place.pos}`}`}
103
+ style={{
104
+ background: ui?.background ?? (p.place == null ? undefined : (p.place.color ?? undefined)),
105
+ outline: ui?.border == null ? undefined : `1px solid ${ui.border}`,
106
+ outlineOffset: ui?.border == null ? undefined : '-1px',
107
+ }}
63
108
  onDragOver={(e) => {
64
109
  // only a row drag: a file dropped on an image var must still reach its own handler
65
110
  if (e.dataTransfer.types.includes('application/x-comfy-var')) e.preventDefault()
@@ -76,7 +121,7 @@ const VarRow = observer(function VarRow(p: {
76
121
  {/* the LABEL is the handle: a separate grip was one more piece of permanent chrome
77
122
  for something the label itself can carry */}
78
123
  <div
79
- className="var-label"
124
+ className={p.jumpKey == null ? 'var-label' : 'var-label has-kbd'}
80
125
  draggable
81
126
  onDragStart={(e) => {
82
127
  e.dataTransfer.effectAllowed = 'move'
@@ -85,7 +130,21 @@ const VarRow = observer(function VarRow(p: {
85
130
  >
86
131
  {/* the kind is a TOOLTIP, not a second line: printed under every label it was a
87
132
  column of noise you read past, and it only ever answers a question you ask once */}
88
- <span data-tip={`${p.v.desc.kind}\ndrag the label to reorder`}>{p.v.desc.label ?? p.v.name}</span>
133
+ {/* the (?) LEADS: labels are right-aligned against their control, so what trails a
134
+ name is what touches the control, and a help mark there read as part of it */}
135
+ {ui?.description == null ? null : (
136
+ <span className="var-help" data-tip={ui.description}>
137
+ ?
138
+ </span>
139
+ )}
140
+ {ui?.icon == null ? null : <VarIcon icon={ui.icon} color={ui.color} />}
141
+ <span
142
+ className="var-name"
143
+ data-tip={`${p.v.desc.label ?? p.v.name ?? ''}\n${inactive ?? p.v.desc.kind}\ndrag the label to reorder`}
144
+ style={ui?.labelColor == null ? undefined : { color: ui.labelColor }}
145
+ >
146
+ {p.v.desc.label ?? p.v.name}
147
+ </span>
89
148
  {p.v.dirty ? (
90
149
  <button
91
150
  type="button"
@@ -96,23 +155,67 @@ const VarRow = observer(function VarRow(p: {
96
155
  ●
97
156
  </button>
98
157
  ) : null}
158
+ {p.jumpKey == null ? null : (
159
+ <span
160
+ className="var-kbd-line"
161
+ data-tip={p.v.desc.kind === 'loras' ? 'opens the loras picker' : 'puts the cursor in this prompt'}
162
+ >
163
+ <span className="kbd-hint">
164
+ {MOD_KEY}
165
+ {p.jumpKey}
166
+ </span>
167
+ </span>
168
+ )}
99
169
  </div>
100
- <div className="var-control">
101
- <VarControl v={p.v} host={p.host} st={p.st} module={p.module} />
170
+ {/* inert, not just dimmed: a disabled field must not take a click or a keystroke */}
171
+ <div className="var-control" inert={inactive != null}>
172
+ <VarControl v={p.v} host={p.host} st={p.st} module={p.module} jumpTarget={p.jumpKey != null} />
102
173
  </div>
103
174
  </div>
104
175
  )
105
176
  })
106
177
 
107
- /** the draft box: name, autosave state as its legend, and the two actions that own this draft.
108
- * duplicate asks for the name INLINE, window.prompt is silently suppressed by browsers after
109
- * a few dialogs, which reads exactly like a dead button */
178
+ /** the handle on the label column's edge: drag to widen or narrow every label at once */
179
+ function LabelResizer(p: { st: WebSt }): ReactNode {
180
+ return (
181
+ <div
182
+ className="label-resizer"
183
+ style={{ left: p.st.labelWidth + 2 }}
184
+ data-tip="drag to resize the label column"
185
+ onPointerDown={(e) => {
186
+ e.preventDefault()
187
+ const startX = e.clientX
188
+ const startW = p.st.labelWidth
189
+ const move = (ev: PointerEvent): void => p.st.setLabelWidth(startW + ev.clientX - startX, false)
190
+ const up = (): void => {
191
+ window.removeEventListener('pointermove', move)
192
+ window.removeEventListener('pointerup', up)
193
+ p.st.setLabelWidth(p.st.labelWidth, true)
194
+ }
195
+ window.addEventListener('pointermove', move)
196
+ window.addEventListener('pointerup', up)
197
+ }}
198
+ />
199
+ )
200
+ }
201
+
202
+ /** `new`, `new 2`, … the first name no draft of this workflow has */
203
+ function freeDraftName(drafts: readonly string[]): string {
204
+ if (!drafts.includes('new')) return 'new'
205
+ let n = 2
206
+ while (drafts.includes(`new ${n}`)) n++
207
+ return `new ${n}`
208
+ }
209
+
210
+ /** the draft box: name, autosave state as its legend, and the actions that own this draft.
211
+ * new and duplicate ask for the name INLINE, window.prompt is silently suppressed by browsers
212
+ * after a few dialogs, which reads exactly like a dead button */
110
213
  const DraftBox = observer(function DraftBox(p: { st: WebSt; form: FormSt }) {
111
214
  const local = useLocalObservable(() => ({
112
215
  /** null = showing the picker; otherwise the pending name and what it will do */
113
- mode: null as null | 'duplicate' | 'rename',
216
+ mode: null as null | 'duplicate' | 'rename' | 'new',
114
217
  name: '',
115
- start(mode: 'duplicate' | 'rename', from: string) {
218
+ start(mode: 'duplicate' | 'rename' | 'new', from: string) {
116
219
  this.mode = mode
117
220
  this.name = mode === 'duplicate' ? `${from} copy` : from
118
221
  },
@@ -130,6 +233,7 @@ const DraftBox = observer(function DraftBox(p: { st: WebSt; form: FormSt }) {
130
233
  local.stop()
131
234
  if (name === '' || mode == null) return
132
235
  if (mode === 'duplicate') void p.st.duplicateDraft(name)
236
+ else if (mode === 'new') void p.st.newDraft(name)
133
237
  else void p.st.renameDraft(name)
134
238
  }
135
239
  return (
@@ -149,53 +253,52 @@ const DraftBox = observer(function DraftBox(p: { st: WebSt; form: FormSt }) {
149
253
  className="head-input"
150
254
  value={local.name}
151
255
  // enter is the ONLY commit now, so it has to be said
152
- placeholder={local.mode === 'rename' ? 'new name, then enter' : 'new draft name, then enter'}
256
+ placeholder={
257
+ local.mode === 'rename'
258
+ ? 'new name, then enter'
259
+ : local.mode === 'new'
260
+ ? 'name of the new draft (workflow defaults), then enter'
261
+ : 'new draft name, then enter'
262
+ }
153
263
  onFocus={(e) => e.currentTarget.select()}
154
264
  onChange={(e) => local.set(e.target.value)}
155
265
  onKeyDown={(e) => {
156
266
  if (e.key === 'Enter') confirm()
157
267
  if (e.key === 'Escape') local.stop()
158
268
  }}
159
- // blur CANCELS, it does not commit: clicking another draft in the sidebar blurred
160
- // this input, and the rename then raced that selection, renameDraft bails when
161
- // the form has already moved on, leaving a duplicate instead of a rename, silently.
162
- // enter commits, which is the only unambiguous signal
269
+ // blur CANCELS, it does not commit: picking another draft blurs this input, and a
270
+ // rename committed on blur raced that selection, renameDraft bails when the form
271
+ // has already moved on, leaving a duplicate instead of a rename, silently. enter
272
+ // commits, which is the only unambiguous signal
163
273
  onBlur={() => local.stop()}
164
274
  />
165
275
  ) : (
166
- /* the name IS the picker: every draft of this workflow, switching selects it */
167
- <select
168
- className="head-select draft"
169
- value={p.form.draft}
170
- data-tip="switch draft"
171
- onChange={(e) => void p.st.select({ module: p.form.moduleKey, draft: e.target.value })}
172
- >
173
- {drafts.map((d) => (
174
- <option key={d} value={d}>
175
- {d}
176
- </option>
177
- ))}
178
- </select>
179
- )}
180
- <span className="head-line">
181
- <span className="btn-group head-group">
276
+ /* the name IS the picker: every draft of this workflow, switching selects it. Rename
277
+ sits before it and delete after it: the two actions ON this name, around it */
278
+ <span className="head-line draft-line">
182
279
  <button
183
280
  type="button"
281
+ className="head-icon"
184
282
  data-tip="rename this draft (the file is renamed)"
185
- onClick={() => (local.mode != null ? confirm() : local.start('rename', p.form.draft))}
283
+ onClick={() => local.start('rename', p.form.draft)}
186
284
  >
187
285
  <Icon name="pen" />
188
286
  </button>
189
- <button
190
- type="button"
191
- data-tip="save these values as a new draft"
192
- onClick={() => (local.mode != null ? confirm() : local.start('duplicate', p.form.draft))}
287
+ <select
288
+ className="head-select draft"
289
+ value={p.form.draft}
290
+ data-tip="switch draft"
291
+ onChange={(e) => void p.st.select({ module: p.form.moduleKey, draft: e.target.value })}
193
292
  >
194
- <Icon name="copy-plus" />
195
- </button>
293
+ {drafts.map((d) => (
294
+ <option key={d} value={d}>
295
+ {d}
296
+ </option>
297
+ ))}
298
+ </select>
196
299
  <button
197
300
  type="button"
198
- className="danger"
301
+ className="head-icon danger"
199
302
  data-tip="delete this draft's file (default resets to the workflow's own values)"
200
303
  onClick={() => {
201
304
  if (window.confirm(`delete draft '${p.form.draft}' of ${p.form.moduleKey}? the file is removed.`))
@@ -205,6 +308,28 @@ const DraftBox = observer(function DraftBox(p: { st: WebSt; form: FormSt }) {
205
308
  <Icon name="trash" />
206
309
  </button>
207
310
  </span>
311
+ )}
312
+ <span className="head-line">
313
+ {/* the two ways to MAKE a draft, side by side: from the workflow's defaults, or from
314
+ what is on screen */}
315
+ <span className="btn-group">
316
+ <button
317
+ type="button"
318
+ className="accent"
319
+ data-tip="new draft with the workflow's own default values"
320
+ onClick={() => (local.mode != null ? confirm() : local.start('new', freeDraftName(drafts)))}
321
+ >
322
+ <Icon name="plus" /> new
323
+ </button>
324
+ <button
325
+ type="button"
326
+ className="accent"
327
+ data-tip="save these values as a new draft"
328
+ onClick={() => (local.mode != null ? confirm() : local.start('duplicate', p.form.draft))}
329
+ >
330
+ <Icon name="copy-plus" /> copy
331
+ </button>
332
+ </span>
208
333
  {/* FAR RIGHT of the same line, outside the group: inside it, the broom appeared and
209
334
  vanished with the dirty count and shoved the other buttons sideways */}
210
335
  {p.form.dirtyCount > 0 ? (
@@ -222,55 +347,82 @@ const DraftBox = observer(function DraftBox(p: { st: WebSt; form: FormSt }) {
222
347
  )
223
348
  })
224
349
 
350
+ function RunChip(p: {
351
+ kind: 'queue' | 'results'
352
+ count: number
353
+ tip: string
354
+ clearTip: string
355
+ canClear: boolean
356
+ onClear(): void
357
+ }): ReactNode {
358
+ const t = runChipText({ kind: p.kind, count: p.count })
359
+ // an icon and a count, the word in the tooltip: the results panel can be narrow
360
+ return (
361
+ <span className={p.count > 0 ? 'run-chip' : 'run-chip empty'} data-tip={`${t.label}: ${p.tip}`}>
362
+ <Icon name={p.kind === 'queue' ? 'rows' : 'image'} size={0.95} />
363
+ <span className="run-chip-count">{t.count}</span>
364
+ <button
365
+ type="button"
366
+ className="run-chip-clear"
367
+ data-tip={p.clearTip}
368
+ aria-label={`clear the ${t.label}`}
369
+ disabled={!p.canClear}
370
+ onClick={() => p.onClear()}
371
+ >
372
+ <Icon name="close" size={0.8} />
373
+ </button>
374
+ </span>
375
+ )
376
+ }
377
+
225
378
  /** everything about running on one line: the button, what is queued behind it, what it has
226
379
  * produced. a count and one clear is the whole decision a queue offers */
227
380
  export const GenerateButton = observer(function GenerateButton(p: { st: WebSt }) {
228
381
  const run = p.st.run
382
+ // the text never changes, so the button never changes size: the progress is a fill sweeping
383
+ // across it, the exact percent is on the running card
384
+ const look = generateButtonLook({ isRunning: run.isRunning, percent: run.progressPercent })
229
385
  return (
230
386
  <span className="run-line">
231
387
  <button
232
388
  type="button"
233
- className={run.isRunning ? 'primary pulse' : 'primary'}
234
- data-tip="⌘⏎ / ctrl+⏎ — click again to queue another"
389
+ className={look.running ? 'primary running' : 'primary'}
390
+ data-tip={
391
+ look.running
392
+ ? `running ${look.fill ?? 0}%: click again to queue another (⌘⏎ / ctrl+⏎)`
393
+ : '⌘⏎ / ctrl+⏎: click again to queue another'
394
+ }
395
+ style={
396
+ look.fill == null
397
+ ? undefined
398
+ : {
399
+ background: `linear-gradient(90deg, var(--accent) ${look.fill}%, var(--accent-dim) ${look.fill}%)`,
400
+ }
401
+ }
235
402
  onClick={() => p.st.generate()}
236
403
  >
237
- <Icon name="play" size={0.85} />{' '}
238
- {run.isRunning
239
- ? run.progressPercent != null
240
- ? `generating… ${Math.round(run.progressPercent)}%`
241
- : 'generating…'
242
- : 'generate'}
404
+ <Icon name="play" size={0.85} /> {look.label}
243
405
  {/* the shortcut is SAID, not only tooltipped: nobody hovers a button they can click */}
244
- {run.isRunning ? null : <span className="kbd-hint">⌘⏎</span>}
406
+ <span className="kbd-hint">{MOD_KEY}⏎</span>
245
407
  </button>
246
- {run.queue.length > 0 ? (
247
- <span className="run-chip" data-tip="prompts waiting behind this one">
248
- queue: {run.queue.length}
249
- {run.pendingCount > 0 ? (
250
- <button
251
- type="button"
252
- className="link"
253
- data-tip={`drop the ${run.pendingCount} not yet sent to the host`}
254
- onClick={() => run.clearQueue()}
255
- >
256
- clear
257
- </button>
258
- ) : null}
259
- </span>
260
- ) : null}
261
- {run.results.length > 0 ? (
262
- <span className="run-chip" data-tip="runs kept in this page">
263
- {run.results.length} result{run.results.length === 1 ? '' : 's'}
264
- <button
265
- type="button"
266
- className="link"
267
- data-tip="forget every run shown here"
268
- onClick={() => run.clear()}
269
- >
270
- clear
271
- </button>
272
- </span>
273
- ) : null}
408
+ {/* both chips are ALWAYS here at one width: a chip appearing, or a count growing a
409
+ digit, moved everything beside it. An empty one is dimmed, its clear disabled */}
410
+ <RunChip
411
+ kind="queue"
412
+ count={run.queue.length}
413
+ tip="prompts waiting behind this one"
414
+ clearTip={`drop the ${run.pendingCount} not yet sent to the host`}
415
+ canClear={run.pendingCount > 0}
416
+ onClear={() => run.clearQueue()}
417
+ />
418
+ <RunChip
419
+ kind="results"
420
+ count={run.results.length}
421
+ tip="runs kept in this page"
422
+ clearTip="forget every run shown here"
423
+ canClear={run.results.length > 0}
424
+ onClear={() => run.clear()}
425
+ />
274
426
  </span>
275
427
  )
276
428
  })
@@ -317,15 +469,32 @@ const SaveRow = observer(function SaveRow(p: { st: WebSt; module: string }) {
317
469
 
318
470
  export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
319
471
  const form = p.st.form
320
- // ⌘⏎ / ctrl+⏎ submits from anywhere, textarea included
472
+ /** which var each jump lands on, as last rendered: the key handler reads it */
473
+ const targetsRef = useRef<{ prompt: string | null; loras: string | null }>({ prompt: null, loras: null })
474
+ // ⌘⏎ / ctrl+⏎ generates from anywhere, textarea and enhancer included: one key, one meaning
321
475
  useEffect(() => {
322
476
  const onKey = (e: KeyboardEvent): void => {
323
- // the enhancer modal owns ⌘⏎ while it is open (refine), so a rewrite never queues a run
324
- if (p.st.enhancer.isOpen) return
325
477
  if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
326
478
  e.preventDefault()
327
- p.st.generate()
479
+ // in the enhancer with a rewrite, generate TRIES it; the form keeps its own prompt
480
+ p.st.generate(p.st.enhancer.tryOverride)
481
+ return
482
+ }
483
+ const s = shortcutOf(e)
484
+ if (s == null) return
485
+ // the jumps land in the form, which the enhancer covers: only the blur still makes sense
486
+ if (p.st.enhancer.isOpen && s !== 'toggle-blur') return
487
+ e.preventDefault()
488
+ if (s === 'toggle-blur') return p.st.toggleBlur()
489
+ if (s === 'open-enhancer') {
490
+ const f = p.st.form
491
+ const v = f?.vars.find((x) => x.name === targetsRef.current.prompt)
492
+ // in lanes mode the enhancer opens on the first lane, the one its ✨ sits on
493
+ if (f != null && v != null)
494
+ p.st.enhancer.openFor({ v, module: f.moduleKey, lane: isPromptLanes(v.value) ? 0 : undefined })
495
+ return
328
496
  }
497
+ p.st.requestJump(s === 'focus-prompt' ? 'prompt' : 'loras')
329
498
  }
330
499
  window.addEventListener('keydown', onKey)
331
500
  return () => window.removeEventListener('keydown', onKey)
@@ -337,6 +506,17 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
337
506
  form.vars.map((v) => v.name),
338
507
  )
339
508
  const orderedVars = orderedNames.map((n) => form.vars.find((v) => v.name === n)).filter((v) => v != null)
509
+ const places = groupPlaces(orderedVars.map((v) => v.desc.ui ?? {}))
510
+ const targets = jumpTargets(
511
+ orderedVars.map((v) => ({ name: v.name, kind: v.desc.kind, inactive: form.inactiveReason(v) != null })),
512
+ )
513
+ targetsRef.current = targets
514
+ const jumpKeyOf = (name: string): string | null =>
515
+ name === targets.prompt
516
+ ? SHORTCUT_KEYS['focus-prompt']
517
+ : name === targets.loras
518
+ ? SHORTCUT_KEYS['open-loras']
519
+ : null
340
520
  return (
341
521
  <div>
342
522
  {/* the TUI header, on the web: labelled boxes for what you are editing and where it runs.
@@ -344,16 +524,15 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
344
524
  column, which the results placement widens and narrows, not against the window */}
345
525
  <div className="head-shell">
346
526
  <div className="head-boxes">
347
- {/* the workflow name IS the way into the menu: the sidebar already holds the
348
- folder → workflow → draft tree, so a second dropdown would be a rival copy of it */}
527
+ {/* the workflow name IS the way into the omnibox, and so is ⌘K / ⌘J */}
349
528
  <div className="head-box">
350
529
  <span className="head-label">workflow</span>
351
530
  <div className="head-line">
352
531
  <button
353
532
  type="button"
354
533
  className="head-value app as-link"
355
- data-tip={p.st.sidebarOpen ? 'close the workflow menu' : 'browse every workflow'}
356
- onClick={() => p.st.toggleSidebar()}
534
+ data-tip="search every workflow and draft (⌘K or ⌘J)"
535
+ onClick={() => p.st.omnibox.open()}
357
536
  >
358
537
  {form.moduleKey}
359
538
  </button>
@@ -362,20 +541,51 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
362
541
  <span className="btn-group">
363
542
  <button
364
543
  type="button"
365
- data-tip={p.st.sidebarOpen ? 'close the workflow menu' : 'browse every workflow'}
366
- onClick={() => p.st.toggleSidebar()}
544
+ data-tip="search every workflow and draft (⌘K or ⌘J)"
545
+ onClick={() => p.st.omnibox.open()}
367
546
  >
368
- <Icon name="folder" />
547
+ <Icon name="search" /> search <span className="kbd-hint">{MOD_KEY}K</span>
369
548
  </button>
370
549
  </span>
371
- <span className="hint">{form.vars.length} vars</span>
550
+ {Object.keys(p.st.loadErrors).length > 0 ? (
551
+ <button
552
+ type="button"
553
+ className="link load-errors"
554
+ data-tip="some workflows failed to load: the list is at the bottom of the search"
555
+ onClick={() => p.st.omnibox.open()}
556
+ >
557
+ <Icon name="warn" /> {Object.keys(p.st.loadErrors).length} failed
558
+ </button>
559
+ ) : null}
372
560
  </div>
373
561
  </div>
374
562
  {/* duplicate and delete act on THIS draft, so they live in the draft box */}
375
563
  <DraftBox st={p.st} form={form} />
376
564
  <div className="head-box">
377
- <span className="head-label">host</span>
378
- <div className="head-line">
565
+ {/* a restart shows HERE, as the card's legend like the draft's `· saving`: a line
566
+ under the cards moved the whole form and read as unrelated to the host */}
567
+ <span className="head-label">
568
+ host
569
+ {p.st.hostWatch === 'down' ? <span className="save-state pulse">· restarting…</span> : null}
570
+ {p.st.hostWatch === 'back' ? <span className="save-state">· back up</span> : null}
571
+ </span>
572
+ {/* the box itself, like the draft: its name, with the two actions ON the box
573
+ around it. The ones on the RUNNING work sit on the line below, in words */}
574
+ <div className="head-line draft-line">
575
+ {/* the ONE refresh: models, nodes and the lora list. It also runs by itself when
576
+ the host changes, pulsing while it works */}
577
+ <button
578
+ type="button"
579
+ className={p.st.refreshing ? 'head-icon pulse' : 'head-icon'}
580
+ data-tip={
581
+ p.st.refreshing
582
+ ? 'refreshing what the host has…'
583
+ : 'refresh what the host has (models, nodes, loras). It also refreshes by itself when something new appears'
584
+ }
585
+ onClick={() => void p.st.refreshHost()}
586
+ >
587
+ <Icon name="refresh" />
588
+ </button>
379
589
  {/* pick where this workflow RUNS (the TUI's host override), remembered per module */}
380
590
  {p.st.hosts.hosts.length > 1 ? (
381
591
  <select
@@ -393,52 +603,38 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
393
603
  ) : (
394
604
  <span className="head-value host">{p.st.hostFor(form.moduleKey) || form.host}</span>
395
605
  )}
606
+ <button
607
+ type="button"
608
+ className="head-icon danger"
609
+ data-tip="restart ComfyUI on that host (manager reboot) — it reconnects when back"
610
+ onClick={() => {
611
+ if (window.confirm(`restart ComfyUI on '${p.st.hostFor(form.moduleKey)}'?`))
612
+ void p.st.hostAction('restart')
613
+ }}
614
+ >
615
+ <Icon name="power" />
616
+ </button>
396
617
  </div>
397
- {/* the TUI's host actions: they act on the box this workflow runs on */}
398
618
  <div className="head-line">
619
+ {/* two separate buttons: stopping the run and emptying the queue are different
620
+ decisions, and the destructive one wears its warning color */}
399
621
  <span className="btn-group">
400
622
  <button
401
623
  type="button"
402
624
  data-tip="interrupt the prompt running now"
403
625
  onClick={() => void p.st.hostAction('interrupt')}
404
626
  >
405
- <Icon name="pause" />
627
+ <Icon name="pause" /> stop
406
628
  </button>
629
+ </span>
630
+ <span className="btn-group">
407
631
  <button
408
632
  type="button"
633
+ className="quiet-danger"
409
634
  data-tip="drop everything still pending in the host queue"
410
635
  onClick={() => void p.st.hostAction('clear-queue')}
411
636
  >
412
- <Icon name="trash" />
413
- </button>
414
- {p.st.drift != null && p.st.drift.host === p.st.hostFor(form.moduleKey) ? (
415
- <button
416
- type="button"
417
- className="attention"
418
- data-tip={`the host changed since this panel loaded its schema (${p.st.drift.summary}): refetch to use it`}
419
- onClick={() => void p.st.hostAction('refresh-schema')}
420
- >
421
- <Icon name="refresh" /> {p.st.drift.summary}
422
- </button>
423
- ) : (
424
- <button
425
- type="button"
426
- data-tip="refetch object_info from the host and rewrite sdk.d.ts (the var lists widen in place)"
427
- onClick={() => void p.st.hostAction('refresh-schema')}
428
- >
429
- <Icon name="refresh" />
430
- </button>
431
- )}
432
- <button
433
- type="button"
434
- className="danger"
435
- data-tip="restart ComfyUI on that host (manager reboot) — it reconnects when back"
436
- onClick={() => {
437
- if (window.confirm(`restart ComfyUI on '${p.st.hostFor(form.moduleKey)}'?`))
438
- void p.st.hostAction('restart')
439
- }}
440
- >
441
- <Icon name="power" />
637
+ <Icon name="trash" /> clear queue
442
638
  </button>
443
639
  </span>
444
640
  {p.st.isHostOverridden(form.moduleKey) ? (
@@ -453,64 +649,18 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
453
649
  ) : null}
454
650
  </div>
455
651
  </div>
456
- {/* its own box beside host: on a phone, scrolling between the knobs and the image
457
- is the whole friction, so the corner placement floats the newest one */}
458
- <div className="head-box">
459
- <span className="head-label">preview</span>
460
- {/* first line: WHERE the results sit. second: what shows up while it runs */}
461
- <div className="head-line">
462
- <span className="btn-group">
463
- {LAYOUTS.map((l) => (
464
- <button
465
- key={l.id}
466
- type="button"
467
- className={p.st.layout === l.id ? 'sel' : ''}
468
- data-tip={l.title}
469
- onClick={() => p.st.setLayout(l.id)}
470
- >
471
- <Icon name={l.icon} />
472
- </button>
473
- ))}
474
- </span>
475
- </div>
476
- <div className="head-line">
477
- <span className="btn-group">
478
- <button
479
- type="button"
480
- className={p.st.showLatent ? 'sel' : ''}
481
- data-tip={
482
- p.st.showLatent ? 'hide the latent preview during a run' : 'show the latent preview'
483
- }
484
- onClick={() => p.st.toggleLatent()}
485
- >
486
- <Icon name="image" />
487
- </button>
488
- <button
489
- type="button"
490
- className={p.st.showLogs ? 'sel' : ''}
491
- data-tip={p.st.showLogs ? 'hide the ComfyUI console' : 'show the ComfyUI console'}
492
- onClick={() => p.st.toggleLogs()}
493
- >
494
- <Icon name="terminal" />
495
- </button>
496
- </span>
497
- </div>
498
- </div>
499
652
  </div>
500
653
  </div>
501
- {/* every host action SAYS what happened: the note was computed and thrown away, which
502
- is precisely why restart looked like a dead button */}
654
+ {/* a host action that FAILS says so on its own line; one that works says nothing here,
655
+ the ↻ pulse and the host card's legend show what runs */}
503
656
  {p.st.hostError != null ? <div className="error">🔴 {p.st.hostError}</div> : null}
504
- {p.st.hostWatch === 'down' ? (
505
- <div className="host-note pulse">restarting… waiting for the host to answer again</div>
506
- ) : null}
507
- {p.st.hostNote != null && p.st.hostWatch !== 'down' ? <div className="host-note">{p.st.hostNote}</div> : null}
508
657
  {/* the autosave state is the draft box's legend now; only a FAILURE gets a line of
509
658
  its own, because that one you must not miss */}
510
659
  {form.saveState === 'error' ? <div className="error">🔴 draft save failed: {form.saveError}</div> : null}
511
- {/* ONE grid for every row (rows are subgrids of it), so the label column can size
512
- itself to the longest label instead of reserving a fixed slab of the width */}
513
- <div className="vars">
660
+ {/* ONE grid for every row (rows are subgrids of it). The label column is as wide as YOU
661
+ drag it (kept in this browser): labels never wrap, a cut one shows whole on hover */}
662
+ <div className="vars" style={{ gridTemplateColumns: `${p.st.labelWidth}px minmax(0, 1fr)` }}>
663
+ <LabelResizer st={p.st} />
514
664
  {orderedVars.map((v, ix) => (
515
665
  // keyed by MODULE and DRAFT: a switch must reset per-row ui state (lora filter,
516
666
  // remembered strengths, paused set), not carry the other selection's over.
@@ -524,19 +674,22 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
524
674
  module={form.moduleKey}
525
675
  index={ix}
526
676
  names={orderedNames}
677
+ place={places[ix] ?? null}
678
+ jumpKey={jumpKeyOf(v.name)}
527
679
  />
528
680
  ))}
529
681
  {/* the OUTPUT is a knob like the others: a row, not a lone button in the header */}
530
682
  <SaveRow st={p.st} module={form.moduleKey} />
531
683
  </div>
532
- {/* side and pinned put generate INSIDE the results panel (it sits next to what it
533
- produces, and on a phone it stays on screen); the form keeps it otherwise. With
534
- neither a button nor an error there is nothing to bar: rendering it anyway left a
535
- sticky bordered strip holding nothing */}
536
- {p.st.generateInResults && p.st.run.error == null ? null : (
684
+ {/* side and pinned put generate INSIDE the results panel, with its error slot; the
685
+ form keeps both otherwise. The error is one reserved line either way, so a failed
686
+ run never adds a bar or pushes anything down */}
687
+ {p.st.generateInResults ? null : (
537
688
  <div className="runbar">
538
- {p.st.generateInResults ? null : <GenerateButton st={p.st} />}
539
- {p.st.run.error != null ? <span className="error">🔴 {p.st.run.error}</span> : null}
689
+ <GenerateButton st={p.st} />
690
+ <span className="run-error" data-tip={p.st.run.error ?? undefined}>
691
+ {p.st.run.error == null ? '' : `🔴 ${p.st.run.error}`}
692
+ </span>
540
693
  </div>
541
694
  )}
542
695
  </div>