comfy-ts 2.7.0 → 2.8.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 (101) hide show
  1. package/README.md +20 -13
  2. package/dist/{DefinedWorkflow-BJgt5t0x.js → DefinedWorkflow-BatWaZO1.js} +199 -16
  3. package/dist/DefinedWorkflow-BatWaZO1.js.map +1 -0
  4. package/dist/{DraftsSt-dizp3VcC.js → LogsSt-DFxzQfDc.js} +152 -4
  5. package/dist/LogsSt-DFxzQfDc.js.map +1 -0
  6. package/dist/cli.js +7 -5
  7. package/dist/cli.js.map +1 -1
  8. package/dist/index.cjs +284 -35
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +125 -7
  11. package/dist/index.d.ts +125 -7
  12. package/dist/index.js +282 -37
  13. package/dist/index.js.map +1 -1
  14. package/dist/run-serve-_nrvJYyt.js +1948 -0
  15. package/dist/run-serve-_nrvJYyt.js.map +1 -0
  16. package/dist/{run-tui-JxlEbb_f.js → run-tui-BPw-SZYW.js} +106 -157
  17. package/dist/run-tui-BPw-SZYW.js.map +1 -0
  18. package/dist/serve-web.js +432 -72
  19. package/dist/{state-CaHeDL-0.js → state-B-boDz-Z.js} +180 -45
  20. package/dist/state-B-boDz-Z.js.map +1 -0
  21. package/dist/web.d.ts +109 -7
  22. package/dist/web.js +235 -36
  23. package/dist/web.js.map +1 -1
  24. package/examples/README.md +1 -0
  25. package/examples/comfy-cloud/sdk.d.ts +4066 -321
  26. package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +18 -2
  27. package/examples/rvion/07-local-llm-text-gen.cflow.ts +220 -0
  28. package/examples/web/tsconfig.json +3 -0
  29. package/extra/README.md +32 -0
  30. package/extra/comfyui-textgen-stream/README.md +35 -0
  31. package/extra/comfyui-textgen-stream/__init__.py +166 -0
  32. package/extra/scripts/fetch_text_encoder.py +137 -0
  33. package/package.json +6 -3
  34. package/src/cli/comfy-ts-cli.ts +3 -1
  35. package/src/cli/serve/ServeApp.ts +754 -40
  36. package/src/cli/serve/applyVarPayload.ts +10 -3
  37. package/src/cli/serve/describeVar.ts +47 -7
  38. package/src/cli/serve/managerOnlyLoras.ts +27 -0
  39. package/src/cli/serve/run-serve.ts +35 -38
  40. package/src/cli/serve/serveSettings.ts +86 -0
  41. package/src/cli/serve/startupPrint.ts +111 -0
  42. package/src/cli/serve/web/api.ts +97 -1
  43. package/src/cli/serve/web/components/App.tsx +61 -22
  44. package/src/cli/serve/web/components/Gallery.tsx +243 -30
  45. package/src/cli/serve/web/components/Icon.tsx +160 -0
  46. package/src/cli/serve/web/components/PromptEnhancer.tsx +12 -9
  47. package/src/cli/serve/web/components/Sidebar.tsx +43 -19
  48. package/src/cli/serve/web/components/VarsForm.tsx +440 -91
  49. package/src/cli/serve/web/components/controls/BasicControls.tsx +38 -5
  50. package/src/cli/serve/web/components/controls/ImageControl.tsx +3 -2
  51. package/src/cli/serve/web/components/controls/LorasControl.tsx +498 -81
  52. package/src/cli/serve/web/components/controls/PresetPicker.tsx +60 -0
  53. package/src/cli/serve/web/components/controls/SeedControl.tsx +38 -20
  54. package/src/cli/serve/web/components/controls/SizeControl.tsx +3 -2
  55. package/src/cli/serve/web/llm.ts +1 -1
  56. package/src/cli/serve/web/logWeb.ts +6 -0
  57. package/src/cli/serve/web/state/EnhancerSt.ts +8 -15
  58. package/src/cli/serve/web/state/FormSt.ts +66 -17
  59. package/src/cli/serve/web/state/RunSt.ts +22 -1
  60. package/src/cli/serve/web/state/WebSt.ts +518 -14
  61. package/src/cli/serve/web/state/lightbox.ts +44 -0
  62. package/src/cli/serve/web/state/moduleTree.ts +52 -0
  63. package/src/cli/serve/web/state/payload.ts +44 -2
  64. package/src/cli/serve/web/state/urlSelection.ts +53 -0
  65. package/src/cli/serve/web/styles.ts +413 -57
  66. package/src/cli/serve/web/tsconfig.json +4 -0
  67. package/src/cli/tui/components/PickerOverlays.tsx +37 -0
  68. package/src/cli/tui/components/StatusBar.tsx +14 -1
  69. package/src/cli/tui/components/TuiApp.tsx +5 -2
  70. package/src/cli/tui/state/HostSt.ts +3 -2
  71. package/src/cli/tui/state/PickerSt.ts +48 -2
  72. package/src/cli/tui/state/TreeSt.ts +1 -1
  73. package/src/cli/tui/state/TuiSt.ts +2 -1
  74. package/src/coreExports.ts +8 -1
  75. package/src/graph/ComfyNode.ts +58 -1
  76. package/src/host/ComfyHost.ts +13 -2
  77. package/src/host/ComfyManager.ts +31 -13
  78. package/src/host/loraInfoCache.ts +35 -1
  79. package/src/host/loraManagerApi.ts +94 -0
  80. package/src/index.ts +2 -0
  81. package/src/promptEnhancers.ts +102 -0
  82. package/src/runner/ComfyExecution.ts +61 -6
  83. package/src/runner/ComfyWorkflow.ts +18 -4
  84. package/src/runner/ComfyWsApi.ts +3 -0
  85. package/src/runner/describePromptRejection.ts +34 -0
  86. package/src/sdk-generator/ComfySchema.ts +17 -4
  87. package/src/sdk-generator/comfyui-sdk-codegen.ts +56 -2
  88. package/src/utils/ansi.ts +13 -0
  89. package/src/utils/matchesRegex.ts +13 -0
  90. package/src/utils/safeName.ts +29 -0
  91. package/src/utils/stringMap.ts +9 -0
  92. package/src/vars/ComfyVars.ts +61 -10
  93. package/src/vars/presets.ts +17 -0
  94. package/dist/DefinedWorkflow-BJgt5t0x.js.map +0 -1
  95. package/dist/DraftsSt-dizp3VcC.js.map +0 -1
  96. package/dist/run-serve-D1Tsuru9.js +0 -1162
  97. package/dist/run-serve-D1Tsuru9.js.map +0 -1
  98. package/dist/run-tui-JxlEbb_f.js.map +0 -1
  99. package/dist/state-CaHeDL-0.js.map +0 -1
  100. package/src/cli/serve/promptEnhancers.ts +0 -69
  101. package/src/cli/serve/safeName.ts +0 -12
@@ -1,6 +1,7 @@
1
1
  // the small per-kind controls: prompt, text, int/float, toggle, choice —
2
2
  // bigger kinds (seed, size, loras, image) have their own files
3
3
  import { observer } from 'mobx-react-lite'
4
+ import { PresetPicker } from 'src/cli/serve/web/components/controls/PresetPicker.tsx'
4
5
  import { PromptEnhancer } from 'src/cli/serve/web/components/PromptEnhancer.tsx'
5
6
  import type { VarSt } from 'src/cli/serve/web/state/FormSt.ts'
6
7
  import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
@@ -8,11 +9,24 @@ import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
8
9
  export const PromptControl = observer(function PromptControl(p: { v: VarSt; st: WebSt; module: string }) {
9
10
  const text = typeof p.v.value === 'string' ? p.v.value : ''
10
11
  const rows = Math.min(12, Math.max(4, text.split('\n').length + 1))
12
+ // what the ACTIVE loras will prepend at build time: invisible until now, so the prompt you
13
+ // read here was not the prompt that ran
14
+ const injected = p.st.form?.loraKeywordsFor(p.v) ?? []
11
15
  return (
12
16
  <div>
17
+ {injected.length > 0 ? (
18
+ <div className="kw-prefix" data-tip="added in front of your prompt at run time, one per active lora">
19
+ {injected.map((kw) => (
20
+ <span key={kw} className="kw-chip">
21
+ {kw}
22
+ </span>
23
+ ))}
24
+ </div>
25
+ ) : null}
13
26
  <textarea rows={rows} value={text} onChange={(e) => p.v.set(e.target.value)} />
14
27
  <div className="row-inline">
15
28
  <span className="hint">// line = comment · "- " line = negative prompt</span>
29
+ <PresetPicker v={p.v} />
16
30
  <PromptEnhancer v={p.v} st={p.st} module={p.module} />
17
31
  </div>
18
32
  </div>
@@ -20,12 +34,31 @@ export const PromptControl = observer(function PromptControl(p: { v: VarSt; st:
20
34
  })
21
35
 
22
36
  export const TextControl = observer(function TextControl(p: { v: VarSt }) {
37
+ const text = typeof p.v.value === 'string' ? p.v.value : ''
38
+ const presets = p.v.desc.textPresets ?? []
39
+ // `v.text(…, { multiline: true })`: an llm instruction is a paragraph, and a one-line field
40
+ // shows its first few words. Grows with the text like the prompt box does
41
+ if (p.v.desc.multiline === true) {
42
+ const rows = Math.min(12, Math.max(3, text.split('\n').length + 1))
43
+ return (
44
+ <div>
45
+ <textarea rows={rows} value={text} onChange={(e) => p.v.set(e.target.value)} />
46
+ {presets.length > 0 ? (
47
+ <div className="row-inline">
48
+ <PresetPicker v={p.v} />
49
+ </div>
50
+ ) : null}
51
+ </div>
52
+ )
53
+ }
54
+ if (presets.length === 0) return <input type="text" value={text} onChange={(e) => p.v.set(e.target.value)} />
55
+ // a one-line field keeps the button BESIDE it: a menu under a single input would sit alone
56
+ // on a row of its own, twice the height for one button
23
57
  return (
24
- <input
25
- type="text"
26
- value={typeof p.v.value === 'string' ? p.v.value : ''}
27
- onChange={(e) => p.v.set(e.target.value)}
28
- />
58
+ <div className="row-inline">
59
+ <input type="text" style={{ flex: 1 }} value={text} onChange={(e) => p.v.set(e.target.value)} />
60
+ <PresetPicker v={p.v} />
61
+ </div>
29
62
  )
30
63
  })
31
64
 
@@ -1,6 +1,7 @@
1
1
  // image: a path/url input the api already accepts, plus a browser upload
2
2
  // (POST /upload → local file under outputs/serve-inputs/) and a preview when
3
3
  // the value is browser-reachable
4
+ import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
4
5
  import { observer } from 'mobx-react-lite'
5
6
  import { useRef } from 'react'
6
7
  import { uploadFile } from 'src/cli/serve/web/api.ts'
@@ -41,13 +42,13 @@ export const ImageControl = observer(function ImageControl(p: { v: VarSt }) {
41
42
  {value !== '' ? (
42
43
  <button
43
44
  type="button"
44
- title="clear the image"
45
+ data-tip="clear the image"
45
46
  onClick={() => {
46
47
  p.v.set('')
47
48
  p.v.setUploadedUrl(null)
48
49
  }}
49
50
  >
50
- ✕
51
+ <Icon name="close" />
51
52
  </button>
52
53
  ) : null}
53
54
  <input