comfy-ts 2.6.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.
- package/README.md +22 -13
- package/dist/{DefinedWorkflow-BJgt5t0x.js → DefinedWorkflow-BatWaZO1.js} +199 -16
- package/dist/DefinedWorkflow-BatWaZO1.js.map +1 -0
- package/dist/{DraftsSt-dizp3VcC.js → LogsSt-DFxzQfDc.js} +152 -4
- package/dist/LogsSt-DFxzQfDc.js.map +1 -0
- package/dist/cli.js +8 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +288 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +128 -7
- package/dist/index.d.ts +128 -7
- package/dist/index.js +286 -37
- package/dist/index.js.map +1 -1
- package/dist/run-serve-_nrvJYyt.js +1948 -0
- package/dist/run-serve-_nrvJYyt.js.map +1 -0
- package/dist/{run-tui-idFhdO4f.js → run-tui-BPw-SZYW.js} +107 -158
- package/dist/run-tui-BPw-SZYW.js.map +1 -0
- package/dist/serve-web.js +434 -81
- package/dist/{state-C90kdjtB.js → state-B-boDz-Z.js} +184 -45
- package/dist/state-B-boDz-Z.js.map +1 -0
- package/dist/web.d.ts +112 -7
- package/dist/web.js +239 -36
- package/dist/web.js.map +1 -1
- package/examples/README.md +1 -0
- package/examples/comfy-cloud/sdk.d.ts +4066 -321
- package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +18 -2
- package/examples/rvion/07-local-llm-text-gen.cflow.ts +220 -0
- package/examples/web/tsconfig.json +7 -1
- package/extra/README.md +32 -0
- package/extra/comfyui-textgen-stream/README.md +35 -0
- package/extra/comfyui-textgen-stream/__init__.py +166 -0
- package/extra/scripts/fetch_text_encoder.py +137 -0
- package/package.json +6 -3
- package/src/cli/comfy-ts-cli.ts +4 -2
- package/src/cli/serve/ServeApp.ts +825 -43
- package/src/cli/serve/applyVarPayload.ts +10 -3
- package/src/cli/serve/describeVar.ts +47 -7
- package/src/cli/serve/managerOnlyLoras.ts +27 -0
- package/src/cli/serve/run-serve.ts +58 -29
- package/src/cli/serve/serveSettings.ts +86 -0
- package/src/cli/serve/startupPrint.ts +111 -0
- package/src/cli/serve/web/api.ts +120 -1
- package/src/cli/serve/web/components/App.tsx +61 -22
- package/src/cli/serve/web/components/Gallery.tsx +243 -30
- package/src/cli/serve/web/components/Icon.tsx +160 -0
- package/src/cli/serve/web/components/PromptEnhancer.tsx +85 -38
- package/src/cli/serve/web/components/Sidebar.tsx +43 -19
- package/src/cli/serve/web/components/VarsForm.tsx +440 -80
- package/src/cli/serve/web/components/controls/BasicControls.tsx +38 -5
- package/src/cli/serve/web/components/controls/ImageControl.tsx +3 -2
- package/src/cli/serve/web/components/controls/LorasControl.tsx +498 -81
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +60 -0
- package/src/cli/serve/web/components/controls/SeedControl.tsx +38 -20
- package/src/cli/serve/web/components/controls/SizeControl.tsx +3 -2
- package/src/cli/serve/web/llm.ts +254 -0
- package/src/cli/serve/web/logWeb.ts +6 -0
- package/src/cli/serve/web/state/EnhancerSt.ts +261 -157
- package/src/cli/serve/web/state/FormSt.ts +70 -18
- package/src/cli/serve/web/state/RunSt.ts +22 -1
- package/src/cli/serve/web/state/WebSt.ts +542 -13
- package/src/cli/serve/web/state/lightbox.ts +44 -0
- package/src/cli/serve/web/state/moduleTree.ts +52 -0
- package/src/cli/serve/web/state/payload.ts +44 -2
- package/src/cli/serve/web/state/urlSelection.ts +53 -0
- package/src/cli/serve/web/styles.ts +415 -57
- package/src/cli/serve/web/tsconfig.json +4 -0
- package/src/cli/tui/components/PickerOverlays.tsx +37 -0
- package/src/cli/tui/components/StatusBar.tsx +14 -1
- package/src/cli/tui/components/TuiApp.tsx +5 -2
- package/src/cli/tui/state/HostSt.ts +3 -2
- package/src/cli/tui/state/PickerSt.ts +48 -2
- package/src/cli/tui/state/TreeSt.ts +1 -1
- package/src/cli/tui/state/TuiSt.ts +2 -1
- package/src/coreExports.ts +8 -1
- package/src/graph/ComfyNode.ts +58 -1
- package/src/host/ComfyHost.ts +13 -2
- package/src/host/ComfyManager.ts +31 -13
- package/src/host/loraInfoCache.ts +35 -1
- package/src/host/loraManagerApi.ts +94 -0
- package/src/index.ts +2 -0
- package/src/promptEnhancers.ts +102 -0
- package/src/runner/ComfyExecution.ts +61 -6
- package/src/runner/ComfyWorkflow.ts +18 -4
- package/src/runner/ComfyWsApi.ts +3 -0
- package/src/runner/describePromptRejection.ts +34 -0
- package/src/sdk-generator/ComfySchema.ts +17 -4
- package/src/sdk-generator/comfyui-sdk-codegen.ts +56 -2
- package/src/state.ts +6 -0
- package/src/utils/ansi.ts +13 -0
- package/src/utils/matchesRegex.ts +13 -0
- package/src/utils/safeName.ts +29 -0
- package/src/utils/stringMap.ts +9 -0
- package/src/vars/ComfyVars.ts +61 -10
- package/src/vars/presets.ts +17 -0
- package/dist/DefinedWorkflow-BJgt5t0x.js.map +0 -1
- package/dist/DraftsSt-dizp3VcC.js.map +0 -1
- package/dist/run-serve-CVu39RNd.js +0 -1002
- package/dist/run-serve-CVu39RNd.js.map +0 -1
- package/dist/run-tui-idFhdO4f.js.map +0 -1
- package/dist/state-C90kdjtB.js.map +0 -1
- package/src/cli/serve/web/openrouter.ts +0 -142
|
@@ -1,26 +1,49 @@
|
|
|
1
1
|
// ✨ on a prompt row → the refine modal: openrouter key + thinking model +
|
|
2
2
|
// a library of named master prompts. Nothing touches the var until APPLY.
|
|
3
|
+
import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
|
|
3
4
|
import { observer } from 'mobx-react-lite'
|
|
4
5
|
import { useEffect } from 'react'
|
|
5
|
-
import type { ReasoningEffort } from 'src/cli/serve/web/
|
|
6
|
-
import type
|
|
6
|
+
import type { ProviderId, ReasoningEffort } from 'src/cli/serve/web/llm.ts'
|
|
7
|
+
import { PROVIDERS, type EnhancerSt } from 'src/cli/serve/web/state/EnhancerSt.ts'
|
|
7
8
|
import type { VarSt } from 'src/cli/serve/web/state/FormSt.ts'
|
|
8
9
|
import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
|
|
9
10
|
|
|
10
11
|
const EFFORTS: ReasoningEffort[] = ['off', 'low', 'medium', 'high']
|
|
11
12
|
|
|
13
|
+
const PROVIDER_LABEL: Record<ProviderId, string> = {
|
|
14
|
+
openrouter: 'openrouter (cloud)',
|
|
15
|
+
openwebui: 'open webui (local)',
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
const Settings = observer(function Settings(p: { e: EnhancerSt }) {
|
|
13
19
|
const models = p.e.visibleModels
|
|
20
|
+
const local = p.e.provider === 'openwebui'
|
|
14
21
|
return (
|
|
15
22
|
<div>
|
|
16
|
-
<div className="section-title">
|
|
23
|
+
<div className="section-title">provider · keys stay in this browser</div>
|
|
17
24
|
<div className="enh-row">
|
|
25
|
+
<select value={p.e.provider} onChange={(ev) => p.e.setProvider(ev.target.value)}>
|
|
26
|
+
{PROVIDERS.map((id) => (
|
|
27
|
+
<option key={id} value={id}>
|
|
28
|
+
{PROVIDER_LABEL[id]}
|
|
29
|
+
</option>
|
|
30
|
+
))}
|
|
31
|
+
</select>
|
|
32
|
+
{local ? (
|
|
33
|
+
<input
|
|
34
|
+
type="text"
|
|
35
|
+
placeholder="http://localhost:3000"
|
|
36
|
+
value={p.e.baseUrl}
|
|
37
|
+
onChange={(ev) => p.e.setBaseUrl(ev.target.value)}
|
|
38
|
+
style={{ flex: 1, minWidth: 180 }}
|
|
39
|
+
/>
|
|
40
|
+
) : null}
|
|
18
41
|
<input
|
|
19
42
|
type="password"
|
|
20
|
-
placeholder=
|
|
43
|
+
placeholder={local ? 'open webui api key (blank if none)' : 'sk-or-v1-… (localStorage only)'}
|
|
21
44
|
value={p.e.apiKey}
|
|
22
45
|
onChange={(ev) => p.e.setApiKey(ev.target.value)}
|
|
23
|
-
style={{ flex: 1, minWidth:
|
|
46
|
+
style={{ flex: 1, minWidth: 160 }}
|
|
24
47
|
/>
|
|
25
48
|
<button type="button" onClick={() => void p.e.loadModels()} disabled={p.e.modelsState === 'loading'}>
|
|
26
49
|
{p.e.modelsState === 'loading' ? 'loading…' : 'load models'}
|
|
@@ -42,27 +65,34 @@ const Settings = observer(function Settings(p: { e: EnhancerSt }) {
|
|
|
42
65
|
) : (
|
|
43
66
|
<input
|
|
44
67
|
type="text"
|
|
45
|
-
placeholder=
|
|
68
|
+
placeholder={local ? 'model id, e.g. qwen3:8b' : 'model id, e.g. anthropic/claude-sonnet-5'}
|
|
46
69
|
value={p.e.model}
|
|
47
70
|
onChange={(ev) => p.e.setModel(ev.target.value)}
|
|
48
71
|
style={{ flex: 1 }}
|
|
49
72
|
/>
|
|
50
73
|
)}
|
|
51
|
-
<label className="row-inline"
|
|
74
|
+
<label className="row-inline" data-tip="hide models that report no reasoning support">
|
|
52
75
|
<input type="checkbox" checked={p.e.thinkingOnly} onChange={() => p.e.toggleThinkingOnly()} />
|
|
53
76
|
<span className="hint">thinking only</span>
|
|
54
77
|
</label>
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
{x}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
{local ? null : (
|
|
79
|
+
<label className="row-inline" data-tip="reasoning effort sent to the model">
|
|
80
|
+
<span className="hint">effort</span>
|
|
81
|
+
<select value={p.e.effort} onChange={(ev) => p.e.setEffort(ev.target.value)}>
|
|
82
|
+
{EFFORTS.map((x) => (
|
|
83
|
+
<option key={x} value={x}>
|
|
84
|
+
{x}
|
|
85
|
+
</option>
|
|
86
|
+
))}
|
|
87
|
+
</select>
|
|
88
|
+
</label>
|
|
89
|
+
)}
|
|
65
90
|
</div>
|
|
91
|
+
{local ? (
|
|
92
|
+
<div className="hint">
|
|
93
|
+
a local model's <think> block is routed to the thinking pane, never into your prompt
|
|
94
|
+
</div>
|
|
95
|
+
) : null}
|
|
66
96
|
{p.e.modelsError !== '' ? <div className="error">🔴 {p.e.modelsError}</div> : null}
|
|
67
97
|
</div>
|
|
68
98
|
)
|
|
@@ -70,22 +100,40 @@ const Settings = observer(function Settings(p: { e: EnhancerSt }) {
|
|
|
70
100
|
|
|
71
101
|
const MasterPrompt = observer(function MasterPrompt(p: { e: EnhancerSt }) {
|
|
72
102
|
const preset = p.e.preset
|
|
73
|
-
if (preset == null)
|
|
103
|
+
if (preset == null) {
|
|
104
|
+
return (
|
|
105
|
+
<div>
|
|
106
|
+
<div className="section-title">master prompt</div>
|
|
107
|
+
<div className="hint">
|
|
108
|
+
{p.e.presetsState === 'loading' ? 'loading .comfy-ts/prompt-enhancers/…' : 'no master prompt yet'}
|
|
109
|
+
</div>
|
|
110
|
+
{p.e.presetsError !== '' ? <div className="error">🔴 {p.e.presetsError}</div> : null}
|
|
111
|
+
<button type="button" onClick={() => p.e.addPreset('refine-prompt')}>
|
|
112
|
+
create one
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
74
117
|
const rename = (): void => {
|
|
75
|
-
const name = window.prompt('rename this master prompt', preset.name)
|
|
76
|
-
if (name != null) p.e.renamePreset(name)
|
|
118
|
+
const name = window.prompt('rename this master prompt (renames the file)', preset.name)
|
|
119
|
+
if (name != null) void p.e.renamePreset(name)
|
|
77
120
|
}
|
|
78
121
|
const create = (): void => {
|
|
79
122
|
const name = window.prompt('name the new master prompt', 'refine-<model>-prompt')
|
|
80
123
|
if (name != null) p.e.addPreset(name)
|
|
81
124
|
}
|
|
125
|
+
const remove = (): void => {
|
|
126
|
+
if (window.confirm(`delete master prompt '${preset.name}'? the .md file is removed.`)) void p.e.deletePreset()
|
|
127
|
+
}
|
|
82
128
|
return (
|
|
83
129
|
<div>
|
|
84
|
-
<div className="section-title">
|
|
130
|
+
<div className="section-title">
|
|
131
|
+
master prompt · one per image model · .comfy-ts/prompt-enhancers/{preset.name}.md
|
|
132
|
+
</div>
|
|
85
133
|
<div className="enh-row">
|
|
86
|
-
<select value={preset.
|
|
134
|
+
<select value={preset.name} onChange={(ev) => p.e.selectPreset(ev.target.value)} style={{ flex: 1 }}>
|
|
87
135
|
{p.e.presets.map((m) => (
|
|
88
|
-
<option key={m.
|
|
136
|
+
<option key={m.name} value={m.name}>
|
|
89
137
|
{m.name}
|
|
90
138
|
</option>
|
|
91
139
|
))}
|
|
@@ -99,17 +147,14 @@ const MasterPrompt = observer(function MasterPrompt(p: { e: EnhancerSt }) {
|
|
|
99
147
|
<button type="button" onClick={rename}>
|
|
100
148
|
rename
|
|
101
149
|
</button>
|
|
102
|
-
<button type="button" onClick={
|
|
103
|
-
|
|
104
|
-
</button>
|
|
105
|
-
<button
|
|
106
|
-
type="button"
|
|
107
|
-
className="link"
|
|
108
|
-
onClick={() => p.e.restoreDefaults()}
|
|
109
|
-
title="re-add the shipped ones"
|
|
110
|
-
>
|
|
111
|
-
restore defaults
|
|
150
|
+
<button type="button" onClick={remove} data-tip="delete this master prompt file">
|
|
151
|
+
<Icon name="close" />
|
|
112
152
|
</button>
|
|
153
|
+
<span className="hint">
|
|
154
|
+
{p.e.saveState === 'saving' ? 'saving…' : null}
|
|
155
|
+
{p.e.saveState === 'saved' ? 'autosaved to disk' : null}
|
|
156
|
+
{p.e.saveState === 'error' ? `🔴 save failed: ${p.e.saveError}` : null}
|
|
157
|
+
</span>
|
|
113
158
|
</div>
|
|
114
159
|
<textarea rows={8} value={preset.text} onChange={(ev) => p.e.setPresetText(ev.target.value)} />
|
|
115
160
|
</div>
|
|
@@ -135,9 +180,11 @@ const Modal = observer(function Modal(p: { e: EnhancerSt }) {
|
|
|
135
180
|
<div className="modal-overlay" onClick={() => e.close()}>
|
|
136
181
|
<div className="modal" onClick={(ev) => ev.stopPropagation()}>
|
|
137
182
|
<div className="modal-head">
|
|
138
|
-
<b style={{ flex: 1 }}
|
|
183
|
+
<b style={{ flex: 1 }}>
|
|
184
|
+
<Icon name="sparkle" /> enhance prompt
|
|
185
|
+
</b>
|
|
139
186
|
<button type="button" onClick={() => e.close()}>
|
|
140
|
-
|
|
187
|
+
<Icon name="close" />
|
|
141
188
|
</button>
|
|
142
189
|
</div>
|
|
143
190
|
<div className="modal-body">
|
|
@@ -173,7 +220,7 @@ const Modal = observer(function Modal(p: { e: EnhancerSt }) {
|
|
|
173
220
|
stop
|
|
174
221
|
</button>
|
|
175
222
|
) : (
|
|
176
|
-
<button type="button" className="primary" onClick={() => e.run()}
|
|
223
|
+
<button type="button" className="primary" onClick={() => e.run()} data-tip="⌘⏎ / ctrl+⏎">
|
|
177
224
|
enhance
|
|
178
225
|
</button>
|
|
179
226
|
)}
|
|
@@ -199,10 +246,10 @@ export const PromptEnhancer = observer(function PromptEnhancer(p: { v: VarSt; st
|
|
|
199
246
|
<button
|
|
200
247
|
type="button"
|
|
201
248
|
className="link"
|
|
202
|
-
|
|
249
|
+
data-tip="rewrite this prompt with an llm"
|
|
203
250
|
onClick={() => e.openFor({ v: p.v, module: p.module })}
|
|
204
251
|
>
|
|
205
|
-
|
|
252
|
+
<Icon name="sparkle" /> enhance
|
|
206
253
|
</button>
|
|
207
254
|
{e.target === p.v ? <Modal e={e} /> : null}
|
|
208
255
|
</>
|
|
@@ -1,29 +1,53 @@
|
|
|
1
|
-
// module → drafts navigation + module load errors, mirrors the TUI tree's job
|
|
1
|
+
// module → drafts navigation + module load errors, mirrors the TUI tree's job.
|
|
2
|
+
// A TREE: folder, then its workflows, then their drafts, the folder is part of
|
|
3
|
+
// what identifies a workflow, and eating it made six workflows look like a flat list
|
|
2
4
|
import { observer } from 'mobx-react-lite'
|
|
5
|
+
import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
|
|
6
|
+
import { groupModulesByFolder } from 'src/cli/serve/web/state/moduleTree.ts'
|
|
3
7
|
import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
|
|
4
8
|
|
|
5
9
|
export const Sidebar = observer(function Sidebar(p: { st: WebSt }) {
|
|
10
|
+
const groups = groupModulesByFolder(p.st.modules)
|
|
6
11
|
return (
|
|
7
12
|
<div className="sidebar">
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{/* it opens from the WORKFLOW head box, which nothing announces: a way OUT that is
|
|
14
|
+
visible from inside is what makes that discoverable, and it says where it is */}
|
|
15
|
+
<div className="side-head">
|
|
16
|
+
<span>workflows</span>
|
|
17
|
+
<button
|
|
18
|
+
type="button"
|
|
19
|
+
data-tip="close — reopen it by clicking the workflow name"
|
|
20
|
+
onClick={() => p.st.toggleSidebar()}
|
|
21
|
+
>
|
|
22
|
+
<Icon name="close" />
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
25
|
+
{groups.map((group) => (
|
|
26
|
+
<div key={group.folder} className="side-group">
|
|
27
|
+
{group.folder === '' ? null : <div className="side-folder">{group.folder}/</div>}
|
|
28
|
+
<div className="side-branch">
|
|
29
|
+
{group.modules.map((mod) => (
|
|
30
|
+
<div key={mod.module}>
|
|
31
|
+
<div className="side-module">
|
|
32
|
+
<span className="name">{mod.module}</span>
|
|
33
|
+
<span className="host">{mod.host}</span>
|
|
34
|
+
</div>
|
|
35
|
+
{mod.drafts.map((draft) => {
|
|
36
|
+
const sel = p.st.form?.moduleKey === mod.module && p.st.form?.draft === draft
|
|
37
|
+
return (
|
|
38
|
+
<button
|
|
39
|
+
key={draft}
|
|
40
|
+
type="button"
|
|
41
|
+
className={sel ? 'side-draft sel' : 'side-draft'}
|
|
42
|
+
onClick={() => void p.st.select({ module: mod.module, draft })}
|
|
43
|
+
>
|
|
44
|
+
{draft}
|
|
45
|
+
</button>
|
|
46
|
+
)
|
|
47
|
+
})}
|
|
48
|
+
</div>
|
|
49
|
+
))}
|
|
13
50
|
</div>
|
|
14
|
-
{mod.drafts.map((draft) => {
|
|
15
|
-
const sel = p.st.form?.moduleKey === mod.module && p.st.form?.draft === draft
|
|
16
|
-
return (
|
|
17
|
-
<button
|
|
18
|
-
key={draft}
|
|
19
|
-
type="button"
|
|
20
|
-
className={sel ? 'side-draft sel' : 'side-draft'}
|
|
21
|
-
onClick={() => void p.st.select({ module: mod.module, draft })}
|
|
22
|
-
>
|
|
23
|
-
{draft}
|
|
24
|
-
</button>
|
|
25
|
-
)
|
|
26
|
-
})}
|
|
27
51
|
</div>
|
|
28
52
|
))}
|
|
29
53
|
{Object.keys(p.st.loadErrors).length > 0 ? (
|