comfy-ts 1.1.0 → 1.3.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 +61 -8
- package/dist/{DefinedWorkflow-BYyu5dK9.js → DefinedWorkflow-gpknV-5f.js} +52 -35
- package/dist/DefinedWorkflow-gpknV-5f.js.map +1 -0
- package/dist/DraftsSt-DmA0jWGl.js +434 -0
- package/dist/DraftsSt-DmA0jWGl.js.map +1 -0
- package/dist/cli.js +17 -4555
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +184 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -23
- package/dist/index.d.ts +36 -5
- package/dist/index.js +184 -32
- package/dist/index.js.map +1 -1
- package/dist/run-serve-Bn6yIJB0.js +638 -0
- package/dist/run-serve-Bn6yIJB0.js.map +1 -0
- package/dist/{run-tui-DZ22HDHI.js → run-tui-BtjaOXRh.js} +791 -395
- package/dist/run-tui-BtjaOXRh.js.map +1 -0
- package/dist/state-DKCPy105.js +4690 -0
- package/dist/state-DKCPy105.js.map +1 -0
- package/examples/README.md +6 -4
- package/examples/{01-txt2img.cflow.ts → rvion/01-txt2img.cflow.ts} +1 -1
- package/examples/{02-img2img-upload.cflow.ts → rvion/02-img2img-upload.cflow.ts} +1 -1
- package/examples/{03-export-workflow-json.cflow.ts → rvion/03-export-workflow-json.cflow.ts} +1 -1
- package/examples/{04-krea2-turbo-t2i.cflow.ts → rvion/04-krea2-turbo-t2i.cflow.ts} +2 -2
- package/examples/{05-comfy-cloud.cflow.ts → rvion/05-comfy-cloud.cflow.ts} +2 -2
- package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
- package/package.json +6 -2
- package/src/cli/comfy-ts-cli.ts +15 -5
- package/src/cli/serve/ServeApp.ts +378 -0
- package/src/cli/serve/applyVarPayload.ts +119 -0
- package/src/cli/serve/describeVar.ts +74 -0
- package/src/cli/serve/run-serve.ts +169 -0
- package/src/cli/tui/components/CopyOverlay.tsx +25 -0
- package/src/cli/tui/components/Header.tsx +9 -4
- package/src/cli/tui/components/HostPanel.tsx +3 -2
- package/src/cli/tui/components/HostsOverlay.tsx +33 -0
- package/src/cli/tui/components/StatusBar.tsx +29 -9
- package/src/cli/tui/components/TreePanel.tsx +33 -9
- package/src/cli/tui/components/TuiApp.tsx +54 -7
- package/src/cli/tui/components/VarsPanel.tsx +67 -34
- package/src/cli/tui/imageClipboard.ts +39 -0
- package/src/cli/tui/imagePicker/fsListing.ts +6 -4
- package/src/cli/tui/listWindow.ts +36 -0
- package/src/cli/tui/run-tui.tsx +47 -7
- package/src/cli/tui/state/DraftsSt.ts +3 -2
- package/src/cli/tui/state/ExecSt.ts +156 -12
- package/src/cli/tui/state/HostSt.ts +94 -10
- package/src/cli/tui/state/PickerSt.ts +8 -2
- package/src/cli/tui/state/QueueSt.ts +2 -2
- package/src/cli/tui/state/SettingsSt.ts +25 -7
- package/src/cli/tui/state/TreeSt.ts +164 -36
- package/src/cli/tui/state/TuiSt.ts +81 -6
- package/src/cli/tui/state/WorkflowsSt.ts +14 -2
- package/src/cli/tui/treeRows.ts +165 -0
- package/src/host/ComfyHost.ts +7 -0
- package/src/litegraph/convertFlowToLiteGraphJSON.ts +11 -7
- package/src/runner/ComfyExecution.ts +21 -4
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/runner/outputPath.ts +75 -0
- package/src/sdk-generator/inputWidgetKind.ts +50 -11
- package/src/sdk-generator/litegraphToApiRequestPayload.ts +14 -7
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +33 -4
- package/src/vars/DefinedWorkflow.ts +21 -8
- package/dist/DefinedWorkflow-BYyu5dK9.js.map +0 -1
- package/dist/run-tui-DZ22HDHI.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComfyNode } from 'src/graph/ComfyNode.ts'
|
|
2
2
|
import type { ComfyWorkflow } from 'src/runner/ComfyWorkflow.ts'
|
|
3
3
|
import { bang } from 'src/utils/bang.ts'
|
|
4
|
-
import {
|
|
4
|
+
import { classifySchemaInput } from 'src/sdk-generator/inputWidgetKind.ts'
|
|
5
5
|
import type { LiteGraphJSON } from 'src/litegraph/LiteGraphJSON.ts'
|
|
6
6
|
import type { LiteGraphLinkTuple } from 'src/litegraph/LiteGraphLink.ts'
|
|
7
7
|
import { asLiteGraphLinkID, type LiteGraphLinkID } from 'src/litegraph/LiteGraphLinkID.ts'
|
|
@@ -42,7 +42,7 @@ const convertNodeToLiteGraphNode = (ctx: LiteGraphCtx, node: ComfyNode<any>): Li
|
|
|
42
42
|
const widgets_values: unknown[] = []
|
|
43
43
|
for (const ipt of node.$schema.inputs) {
|
|
44
44
|
const raw = node.serializeValue(ipt.nameInComfy, node.json.inputs[ipt.nameInComfy])
|
|
45
|
-
const
|
|
45
|
+
const kind = classifySchemaInput(ipt)
|
|
46
46
|
if (_isLink(raw)) {
|
|
47
47
|
const nodeUidNumber = bang(
|
|
48
48
|
ctx.graph.nodes.find((n) => n.uid === raw[0])?.uidNumber,
|
|
@@ -61,11 +61,15 @@ const convertNodeToLiteGraphNode = (ctx: LiteGraphCtx, node: ComfyNode<any>): Li
|
|
|
61
61
|
ipt.typeName,
|
|
62
62
|
),
|
|
63
63
|
})
|
|
64
|
-
} else if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
} else if (kind.kind === 'widget') {
|
|
65
|
+
// frontend button-widget values ride BEFORE the real value (LOAD_3D)
|
|
66
|
+
widgets_values.push(...kind.prefixValues, raw)
|
|
67
|
+
// control_after_generate phantom AFTER the value: the classifier's
|
|
68
|
+
// consumes covers prefix + value + control, config-driven (the 2024
|
|
69
|
+
// INT-named-seed heuristic lives inside controlConsumes), so export
|
|
70
|
+
// and import can never disagree on the run length
|
|
71
|
+
const phantoms = kind.consumes - 1 - kind.prefixValues.length
|
|
72
|
+
for (let i = 0; i < phantoms; i++) widgets_values.push(false)
|
|
69
73
|
} else {
|
|
70
74
|
// unconnected link-kind input: a litegraph slot with no link —
|
|
71
75
|
// NEVER a widget value (that would misalign the round-trip import)
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import { dirname
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { dirname } from 'pathe'
|
|
3
|
+
import { localOutputPath, runTimestamp, uniquifyOutputPath } from 'src/runner/outputPath.ts'
|
|
4
|
+
|
|
5
|
+
/** paths claimed by in-flight retrievals: two same-second runs on a
|
|
6
|
+
* counter-resetting cloud host compute the same name before either writes */
|
|
7
|
+
const CLAIMED_OUTPUT_PATHS = new Set<string>()
|
|
3
8
|
import sharp, { type FormatEnum } from 'sharp'
|
|
4
9
|
import type { ComfyHost } from 'src/host/ComfyHost.ts'
|
|
5
10
|
import { getPngMetadataFromUint8Array } from 'src/image-utils/_getPngMetadata.ts'
|
|
@@ -204,15 +209,27 @@ export class ComfyExecution {
|
|
|
204
209
|
// image route on the host (cloud answers a 302 signed url — fetchFile follows it unauthed)
|
|
205
210
|
const imgRoute = '/view?' + new URLSearchParams(comfyImageInfo).toString()
|
|
206
211
|
|
|
207
|
-
// target path on disk
|
|
212
|
+
// target path on disk: OUR naming, never the raw server filename — a
|
|
213
|
+
// cloud host resets its _00001_ counter per run, so the server name
|
|
214
|
+
// overwrote the same local file on every run (his repro 2026-07-31)
|
|
208
215
|
const sf = this.saveFormat
|
|
216
|
+
const promptPrefix = promptNode.inputs['filename_prefix']
|
|
209
217
|
let absPath: string = comfyts.resolveFromOutput(
|
|
210
|
-
|
|
218
|
+
localOutputPath({
|
|
219
|
+
localDir: sf?.prefix,
|
|
220
|
+
filenamePrefix: typeof promptPrefix === 'string' ? promptPrefix : undefined,
|
|
221
|
+
subfolder: comfyImageInfo.subfolder,
|
|
222
|
+
filename: comfyImageInfo.filename,
|
|
223
|
+
timestamp: runTimestamp(new Date(this.startedAt)),
|
|
224
|
+
}),
|
|
211
225
|
)
|
|
212
226
|
if (sf?.format && sf.format !== 'raw') {
|
|
213
227
|
const extension = sf.format.split('/')[1]
|
|
214
228
|
absPath += '.' + extension
|
|
215
229
|
}
|
|
230
|
+
// last-resort uniquifier: bump past files on disk AND paths claimed by
|
|
231
|
+
// still-downloading retrievals — never overwrite
|
|
232
|
+
absPath = uniquifyOutputPath({ path: absPath, exists: existsSync, claimed: CLAIMED_OUTPUT_PATHS })
|
|
216
233
|
const dir = dirname(absPath)
|
|
217
234
|
mkdirSync(dir, { recursive: true })
|
|
218
235
|
|
|
@@ -15,9 +15,9 @@ import type { ComfyWorkflow } from 'src/runner/ComfyWorkflow.ts'
|
|
|
15
15
|
export function comfyWorkflowAutoLayout(
|
|
16
16
|
this: ComfyWorkflow,
|
|
17
17
|
p?: {
|
|
18
|
-
/** @default:
|
|
18
|
+
/** @default: 40 */
|
|
19
19
|
node_vsep?: number
|
|
20
|
-
/** @default:
|
|
20
|
+
/** @default: 100 */
|
|
21
21
|
node_hsep?: number
|
|
22
22
|
/** @default false */
|
|
23
23
|
forceLeft?: boolean
|
|
@@ -70,8 +70,10 @@ export function comfyWorkflowAutoLayout(
|
|
|
70
70
|
else cols[at] = [node]
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
// real ComfyUI nodes render wider than the 200px layout estimate, so the
|
|
74
|
+
// horizontal gap is generous to keep pasted graphs readable
|
|
75
|
+
const HSEP = p?.node_hsep ?? 100
|
|
76
|
+
const VSEP = p?.node_vsep ?? 40
|
|
75
77
|
// cols.reverse()
|
|
76
78
|
let colX = 0
|
|
77
79
|
let maxY = 0
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* local output naming, relative to `.comfy-ts/outputs/` (his repro
|
|
3
|
+
* 2026-07-31): the server filename is NOT unique — cloud hosts reset the
|
|
4
|
+
* `_00001_` counter every run, so trusting it overwrote the same file — and
|
|
5
|
+
* a `foo/krea/` prefix means the DIRECTORY foo/krea/, not a `krea_` name
|
|
6
|
+
* prefix. Local names are ours: dir from the prompt's own filename_prefix
|
|
7
|
+
* (or an explicit saveFormat.prefix override), then
|
|
8
|
+
* `<stem>_<timestamp>_<counter><ext>` so every run sorts chronologically
|
|
9
|
+
* per stem and nothing ever collides.
|
|
10
|
+
*/
|
|
11
|
+
export const localOutputPath = (p: {
|
|
12
|
+
/** explicit local dir override (ImageSaveFormat.prefix) — wins when set */
|
|
13
|
+
localDir?: string
|
|
14
|
+
/** the SaveImage node's own filename_prefix as sent in the prompt */
|
|
15
|
+
filenamePrefix?: string
|
|
16
|
+
/** server-reported subfolder (fallback when no prefix is known) */
|
|
17
|
+
subfolder: string
|
|
18
|
+
/** server-reported filename, e.g. krea_00001_.png */
|
|
19
|
+
filename: string
|
|
20
|
+
/** run timestamp, YYYYMMDD-HHmmss */
|
|
21
|
+
timestamp: string
|
|
22
|
+
}): string => {
|
|
23
|
+
// server name → stem / counter / extension: `krea_00001_.png`
|
|
24
|
+
const dot = p.filename.lastIndexOf('.')
|
|
25
|
+
const ext = dot === -1 ? '' : p.filename.slice(dot)
|
|
26
|
+
const base = dot === -1 ? p.filename : p.filename.slice(0, dot)
|
|
27
|
+
const counterMatch = /_(\d+)_$/.exec(base)
|
|
28
|
+
const counter = counterMatch?.[1]
|
|
29
|
+
const serverStem = counterMatch != null ? base.slice(0, base.length - counterMatch[0].length) : base
|
|
30
|
+
|
|
31
|
+
// directory + stem intent: explicit local dir > prompt prefix > server
|
|
32
|
+
// layout. The stem SURVIVES a localDir override — identity keeps sorting
|
|
33
|
+
let dir: string
|
|
34
|
+
let stem: string
|
|
35
|
+
if (p.filenamePrefix != null && p.filenamePrefix !== '') {
|
|
36
|
+
const slash = p.filenamePrefix.lastIndexOf('/')
|
|
37
|
+
dir = slash === -1 ? '' : p.filenamePrefix.slice(0, slash)
|
|
38
|
+
stem = slash === -1 ? p.filenamePrefix : p.filenamePrefix.slice(slash + 1)
|
|
39
|
+
} else {
|
|
40
|
+
dir = p.subfolder
|
|
41
|
+
stem = serverStem
|
|
42
|
+
}
|
|
43
|
+
if (p.localDir != null) dir = p.localDir
|
|
44
|
+
|
|
45
|
+
const name = [stem === '' ? null : stem, p.timestamp, counter].filter((x) => x != null).join('_') + ext
|
|
46
|
+
return dir === '' ? name : `${dir}/${name}`
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* never-overwrite guard: bump `-2`, `-3`, … while the path exists on disk OR
|
|
51
|
+
* was already CLAIMED by a still-downloading retrieval (two same-second runs
|
|
52
|
+
* on a counter-resetting cloud host compute the same name — reviewer catch).
|
|
53
|
+
* The chosen path is claimed before returning.
|
|
54
|
+
*/
|
|
55
|
+
export const uniquifyOutputPath = (p: {
|
|
56
|
+
path: string
|
|
57
|
+
exists: (path: string) => boolean
|
|
58
|
+
claimed: Set<string>
|
|
59
|
+
}): string => {
|
|
60
|
+
let out = p.path
|
|
61
|
+
if (p.exists(out) || p.claimed.has(out)) {
|
|
62
|
+
const dot = out.lastIndexOf('.')
|
|
63
|
+
const stem = dot === -1 ? out : out.slice(0, dot)
|
|
64
|
+
const ext = dot === -1 ? '' : out.slice(dot)
|
|
65
|
+
for (let n = 2; p.exists(out) || p.claimed.has(out); n++) out = `${stem}-${n}${ext}`
|
|
66
|
+
}
|
|
67
|
+
p.claimed.add(out)
|
|
68
|
+
return out
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** YYYYMMDD-HHmmss, local time — sortable, text-encodable, no colons for filesystems */
|
|
72
|
+
export const runTimestamp = (d: Date): string => {
|
|
73
|
+
const pad = (n: number): string => String(n).padStart(2, '0')
|
|
74
|
+
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`
|
|
75
|
+
}
|
|
@@ -11,7 +11,20 @@ import { ComfyPrimitiveMapping } from 'src/sdk-generator/Primitives.ts'
|
|
|
11
11
|
*/
|
|
12
12
|
export type InputWidgetKind =
|
|
13
13
|
| { kind: 'slot' }
|
|
14
|
-
| {
|
|
14
|
+
| {
|
|
15
|
+
kind: 'widget'
|
|
16
|
+
/** total widgets_values entries this input's run occupies: prefix buttons + value + control phantom */
|
|
17
|
+
consumes: number
|
|
18
|
+
strictValues: boolean
|
|
19
|
+
/**
|
|
20
|
+
* serialized values the frontend addWidget()s BEFORE the real value
|
|
21
|
+
* (button widgets, creation order). Import reads the value at
|
|
22
|
+
* `offset + prefixValues.length`; export writes these literals first
|
|
23
|
+
* so a round-trip through the ComfyUI editor keeps positional
|
|
24
|
+
* alignment. Empty for every config-signalled widget.
|
|
25
|
+
*/
|
|
26
|
+
prefixValues: readonly unknown[]
|
|
27
|
+
}
|
|
15
28
|
| { kind: 'dynamic-combo'; options: DynamicComboOption[]; defaultKey: string }
|
|
16
29
|
| { kind: 'dynamic-container'; instanceNames: string[]; requiredCount: number }
|
|
17
30
|
|
|
@@ -110,6 +123,24 @@ export const containerInstanceSlotType = (opts: unknown): string | null => {
|
|
|
110
123
|
return first.type
|
|
111
124
|
}
|
|
112
125
|
|
|
126
|
+
/**
|
|
127
|
+
* frontend-registered widgets whose object_info opts carry NO config signal —
|
|
128
|
+
* the one exception to config-only classification (architecture.md rule 8).
|
|
129
|
+
* Every entry must quote the frontend widget-creation source.
|
|
130
|
+
*
|
|
131
|
+
* LOAD_3D (ComfyUI_frontend src/extensions/core/load3d.ts, verified
|
|
132
|
+
* 2026-07-31): the LOAD_3D custom widget handler runs
|
|
133
|
+
* node.addWidget('button', 'upload 3d model', 'upload3dmodel', …)
|
|
134
|
+
* node.addWidget('button', 'upload extra resources', 'uploadExtraResources', …)
|
|
135
|
+
* node.addWidget('button', 'clear', 'clear', …)
|
|
136
|
+
* THEN creates the scene widget, so the serialized run is
|
|
137
|
+
* [btn, btn, btn, value] with the real value LAST. Lax domain: '' in saved
|
|
138
|
+
* files, an {image, mask, normal, camera_info, …} dict at queue time.
|
|
139
|
+
*/
|
|
140
|
+
const EMPTY_CONFIG_FRONTEND_WIDGETS: Record<string, { prefixValues: readonly unknown[] }> = {
|
|
141
|
+
LOAD_3D: { prefixValues: ['upload3dmodel', 'uploadExtraResources', 'clear'] },
|
|
142
|
+
}
|
|
143
|
+
|
|
113
144
|
export const classifyWidgetInput = (p: {
|
|
114
145
|
name: string
|
|
115
146
|
type: string | readonly unknown[]
|
|
@@ -123,14 +154,19 @@ export const classifyWidgetInput = (p: {
|
|
|
123
154
|
// 2. enum arrays / parsed E_ unions are combo widgets
|
|
124
155
|
if (Array.isArray(p.type) || p.isEnumUnion === true) {
|
|
125
156
|
const tn = typeof p.type === 'string' ? p.type : 'COMBO'
|
|
126
|
-
return { kind: 'widget', consumes: controlConsumes(o, tn, p.name), strictValues: true }
|
|
157
|
+
return { kind: 'widget', consumes: controlConsumes(o, tn, p.name), strictValues: true, prefixValues: [] }
|
|
127
158
|
}
|
|
128
159
|
if (typeof p.type !== 'string') return { kind: 'slot' }
|
|
129
160
|
// 3. widgetType names the widget for multi-type unions (frontend: widgets.get(widgetType ?? type))
|
|
130
161
|
const widgetTypeName = typeof o?.['widgetType'] === 'string' ? o['widgetType'] : p.type
|
|
131
162
|
// 4. primitives
|
|
132
163
|
if (ComfyPrimitiveMapping[widgetTypeName] != null)
|
|
133
|
-
return {
|
|
164
|
+
return {
|
|
165
|
+
kind: 'widget',
|
|
166
|
+
consumes: controlConsumes(o, widgetTypeName, p.name),
|
|
167
|
+
strictValues: true,
|
|
168
|
+
prefixValues: [],
|
|
169
|
+
}
|
|
134
170
|
// 5. options array: dynamic {key, inputs} family, else plain combo
|
|
135
171
|
const options = o?.['options']
|
|
136
172
|
if (Array.isArray(options)) {
|
|
@@ -141,7 +177,7 @@ export const classifyWidgetInput = (p: {
|
|
|
141
177
|
const defaultKey = typeof o?.['default'] === 'string' ? o['default'] : first.key
|
|
142
178
|
return { kind: 'dynamic-combo', options: dynOptions, defaultKey }
|
|
143
179
|
}
|
|
144
|
-
return { kind: 'widget', consumes: controlConsumes(o, p.type, p.name), strictValues: true }
|
|
180
|
+
return { kind: 'widget', consumes: controlConsumes(o, p.type, p.name), strictValues: true, prefixValues: [] }
|
|
145
181
|
}
|
|
146
182
|
// 6. template WITH nested input = autogrow container; WITHOUT = matchtype slot typing
|
|
147
183
|
const template = o?.['template']
|
|
@@ -150,7 +186,16 @@ export const classifyWidgetInput = (p: {
|
|
|
150
186
|
return { kind: 'slot' }
|
|
151
187
|
}
|
|
152
188
|
// 7. socketless: a widget that never has a socket (IMAGECOMPARE, COLOR); value domain unknown
|
|
153
|
-
if (o?.['socketless'] === true) return { kind: 'widget', consumes: 1, strictValues: false }
|
|
189
|
+
if (o?.['socketless'] === true) return { kind: 'widget', consumes: 1, strictValues: false, prefixValues: [] }
|
|
190
|
+
// 8. known empty-config frontend widgets (LOAD_3D), the one non-config exception
|
|
191
|
+
const emptyConfigEntry = EMPTY_CONFIG_FRONTEND_WIDGETS[widgetTypeName]
|
|
192
|
+
if (emptyConfigEntry != null)
|
|
193
|
+
return {
|
|
194
|
+
kind: 'widget',
|
|
195
|
+
consumes: emptyConfigEntry.prefixValues.length + 1,
|
|
196
|
+
strictValues: false,
|
|
197
|
+
prefixValues: emptyConfigEntry.prefixValues,
|
|
198
|
+
}
|
|
154
199
|
return { kind: 'slot' }
|
|
155
200
|
}
|
|
156
201
|
|
|
@@ -162,12 +207,6 @@ export const classifySchemaInput = (input: NodeInputExt): InputWidgetKind =>
|
|
|
162
207
|
isEnumUnion: input.isEnum,
|
|
163
208
|
})
|
|
164
209
|
|
|
165
|
-
/** how many widgets_values entries this schema input consumes (export path + positional walks) */
|
|
166
|
-
export const howManyWidgetValuesForThisSchemaType = (input: NodeInputExt): number => {
|
|
167
|
-
const kind = classifySchemaInput(input)
|
|
168
|
-
return kind.kind === 'widget' ? kind.consumes : 0
|
|
169
|
-
}
|
|
170
|
-
|
|
171
210
|
/**
|
|
172
211
|
* what ComfyUI's frontend gives a widget created with no serialized value
|
|
173
212
|
* (`getWidgetDefaultValue` semantics), used when a positional array is
|
|
@@ -145,15 +145,19 @@ export const convertLiteGraphToPrompt = (
|
|
|
145
145
|
)
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
/** named wins, then positional cursor; filled=true when both miss (caller falls back to the schema default) */
|
|
149
|
-
const resolveWidgetValue = (p: {
|
|
148
|
+
/** named wins, then positional cursor (+prefixLen skips leading button values, LOAD_3D); filled=true when both miss (caller falls back to the schema default) */
|
|
149
|
+
const resolveWidgetValue = (p: {
|
|
150
|
+
promptName: string
|
|
151
|
+
consumes: number
|
|
152
|
+
prefixLen: number
|
|
153
|
+
}): { value: unknown; filled: boolean } => {
|
|
150
154
|
let value: unknown
|
|
151
155
|
let has = false
|
|
152
156
|
if (Object.hasOwn(named, p.promptName)) {
|
|
153
157
|
value = named[p.promptName]
|
|
154
158
|
has = true
|
|
155
|
-
} else if (offset < positional.length) {
|
|
156
|
-
value = positional[offset]
|
|
159
|
+
} else if (offset + p.prefixLen < positional.length) {
|
|
160
|
+
value = positional[offset + p.prefixLen]
|
|
157
161
|
has = true
|
|
158
162
|
}
|
|
159
163
|
if (positional.length > 0) offset += p.consumes // named-shadow still advances (promotion case)
|
|
@@ -165,11 +169,12 @@ export const convertLiteGraphToPrompt = (
|
|
|
165
169
|
typeName: string
|
|
166
170
|
opts: unknown
|
|
167
171
|
consumes: number
|
|
172
|
+
prefixLen: number
|
|
168
173
|
strict: boolean
|
|
169
174
|
enumValues?: readonly (string | boolean | number)[]
|
|
170
175
|
linkedInput: CanonicalInput | undefined
|
|
171
176
|
}): void => {
|
|
172
|
-
const r = resolveWidgetValue({ promptName: p.promptName, consumes: p.consumes })
|
|
177
|
+
const r = resolveWidgetValue({ promptName: p.promptName, consumes: p.consumes, prefixLen: p.prefixLen })
|
|
173
178
|
const raw = r.filled
|
|
174
179
|
? defaultValueForWidget({
|
|
175
180
|
type: p.typeName,
|
|
@@ -185,7 +190,7 @@ export const convertLiteGraphToPrompt = (
|
|
|
185
190
|
|
|
186
191
|
/** key consumed first, then the SELECTED branch inline, recursively (backend get_finalized_class_inputs) */
|
|
187
192
|
const consumeDynamicCombo = (p: { path: string; options: DynamicComboOption[]; defaultKey: string }): void => {
|
|
188
|
-
const r = resolveWidgetValue({ promptName: p.path, consumes: 1 })
|
|
193
|
+
const r = resolveWidgetValue({ promptName: p.path, consumes: 1, prefixLen: 0 })
|
|
189
194
|
const key = r.filled ? p.defaultKey : r.value
|
|
190
195
|
if (typeof key !== 'string')
|
|
191
196
|
throw new WorkflowConvertError(
|
|
@@ -224,6 +229,7 @@ export const convertLiteGraphToPrompt = (
|
|
|
224
229
|
typeName: typeof sub.type === 'string' ? sub.type : 'COMBO',
|
|
225
230
|
opts: sub.opts,
|
|
226
231
|
consumes: kind.consumes,
|
|
232
|
+
prefixLen: kind.prefixValues.length,
|
|
227
233
|
strict: kind.strictValues,
|
|
228
234
|
enumValues: inlineEnum,
|
|
229
235
|
linkedInput: inputsInNodeJSON.find((i) => i.name === subPath),
|
|
@@ -238,7 +244,7 @@ export const convertLiteGraphToPrompt = (
|
|
|
238
244
|
// proves a widget value was written, so consume per the file's era
|
|
239
245
|
if (kind.kind === 'slot' && input?.widgetName != null) {
|
|
240
246
|
const legacyConsumes = howManyWidgetValuesForThisInputType(input.type, field.nameInComfy)
|
|
241
|
-
kind = { kind: 'widget', consumes: legacyConsumes === 2 ? 2 : 1, strictValues: true }
|
|
247
|
+
kind = { kind: 'widget', consumes: legacyConsumes === 2 ? 2 : 1, strictValues: true, prefixValues: [] }
|
|
242
248
|
}
|
|
243
249
|
|
|
244
250
|
if (kind.kind === 'widget') {
|
|
@@ -247,6 +253,7 @@ export const convertLiteGraphToPrompt = (
|
|
|
247
253
|
typeName: field.typeName,
|
|
248
254
|
opts: field.opts,
|
|
249
255
|
consumes: kind.consumes,
|
|
256
|
+
prefixLen: kind.prefixValues.length,
|
|
250
257
|
strict: kind.strictValues,
|
|
251
258
|
linkedInput: input,
|
|
252
259
|
})
|
package/src/state.ts
CHANGED
|
@@ -6,6 +6,12 @@ import { parseHostBase, renderHttpBase } from 'src/host/hostUrl.ts'
|
|
|
6
6
|
import { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
7
7
|
import { type AbsolutePath, asAbsolutePath, type RelativePath } from 'src/types/index.ts'
|
|
8
8
|
|
|
9
|
+
/** the ONE settings-file location rule — run-tui reads it BEFORE any module
|
|
10
|
+
* import creates the comfyts global, so the path logic cannot live on the instance only */
|
|
11
|
+
export function settingsPathFor(root: string): AbsolutePath {
|
|
12
|
+
return asAbsolutePath(join(root, '.comfy-ts', 'settings.json'))
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
/** singleton */
|
|
10
16
|
export class ComfyTS {
|
|
11
17
|
version = pkgJson.version
|
|
@@ -99,7 +105,7 @@ export class ComfyTS {
|
|
|
99
105
|
|
|
100
106
|
/** local TUI settings (preview mode, last draft per workflow) — gitignored */
|
|
101
107
|
get settingsPath(): AbsolutePath {
|
|
102
|
-
return
|
|
108
|
+
return settingsPathFor(this.rootPath)
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
resolveFromHosts(relativePath: string): AbsolutePath {
|
package/src/vars/ComfyVars.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Vars: the standard "tweak & re-run" contract. A workflow defined via
|
|
2
2
|
// host.defineWorkflow({ vars, build }) rebuilds its graph from current var
|
|
3
3
|
// values on every run — drivers (scripts, the TUI) edit vars between runs.
|
|
4
|
+
import { readFileSync } from 'node:fs'
|
|
4
5
|
import { homedir } from 'node:os'
|
|
6
|
+
import { imageMeta } from 'image-meta'
|
|
5
7
|
import { action, makeObservable, observable } from 'mobx'
|
|
6
|
-
import { isAbsolute, join, resolve } from 'pathe'
|
|
8
|
+
import { basename, isAbsolute, join, resolve } from 'pathe'
|
|
7
9
|
import { getLoraKeyword } from 'src/vars/loraKeywords.ts'
|
|
8
10
|
|
|
9
11
|
export type VarKind = 'text' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' | 'image'
|
|
@@ -226,6 +228,12 @@ export class SeedVar extends ComfyVar<number> {
|
|
|
226
228
|
override afterRun(): void {
|
|
227
229
|
this.advance()
|
|
228
230
|
}
|
|
231
|
+
/** mode is part of the seed's state: a reset must not keep a caller's `?`/`+` alive
|
|
232
|
+
* ('=' is the construction default; drafts restore their own mode via loadJSON) */
|
|
233
|
+
override reset(): this {
|
|
234
|
+
this.setMode('=')
|
|
235
|
+
return super.reset()
|
|
236
|
+
}
|
|
229
237
|
/** parse `+` `- 12` `= 5` `?` or a bare number (=> fixed). Keeps the current number when none given */
|
|
230
238
|
parse(raw: string): boolean {
|
|
231
239
|
const m = raw.trim().match(/^([+\-=?])?\s*(\d+)?$/)
|
|
@@ -445,17 +453,36 @@ export const DEFAULT_SIZE_PRESETS: SizePreset[] = [
|
|
|
445
453
|
{ label: '9:16 tall', width: 768, height: 1344 },
|
|
446
454
|
]
|
|
447
455
|
|
|
448
|
-
/** width/height picker: presets + free `WxH` entry
|
|
456
|
+
/** width/height picker: presets + free `WxH` entry + optionally the LIVE
|
|
457
|
+
* size of a linked image var (his ask 2026-07-30: the widget shows
|
|
458
|
+
* `WxH size of image '<name>'` as a pickable row) */
|
|
449
459
|
export class SizeVar extends ComfyVar<SizeValue> {
|
|
450
460
|
readonly kind = 'size' as const
|
|
451
461
|
constructor(
|
|
452
462
|
defaultValue: SizeValue = { width: 1024, height: 1024 },
|
|
453
463
|
public readonly presets: SizePreset[] = DEFAULT_SIZE_PRESETS,
|
|
454
464
|
label?: string,
|
|
465
|
+
public readonly imageVar?: ImageVar,
|
|
455
466
|
) {
|
|
456
467
|
super(defaultValue, label)
|
|
457
468
|
}
|
|
458
469
|
|
|
470
|
+
/** current dimensions of the linked image var — null when no link, unset
|
|
471
|
+
* path, or an unreadable/undecodable file (those errors belong to the
|
|
472
|
+
* image var itself, the size row simply disappears) */
|
|
473
|
+
imageSize(): { width: number; height: number; name: string } | null {
|
|
474
|
+
const iv = this.imageVar
|
|
475
|
+
if (iv == null || iv.value === '') return null
|
|
476
|
+
try {
|
|
477
|
+
const abs = iv.absPath()
|
|
478
|
+
const meta = imageMeta(new Uint8Array(readFileSync(abs)))
|
|
479
|
+
if (meta.width == null || meta.height == null) return null
|
|
480
|
+
return { width: meta.width, height: meta.height, name: basename(abs) }
|
|
481
|
+
} catch {
|
|
482
|
+
return null
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
459
486
|
/** accepts '1024x768' / '1024×768' / a preset label */
|
|
460
487
|
parse(raw: string): boolean {
|
|
461
488
|
const m = raw.trim().match(/^(\d+)\s*[x×]\s*(\d+)$/)
|
|
@@ -569,8 +596,8 @@ export const v = {
|
|
|
569
596
|
initial: Partial<Record<T, LoraStrength>> = {},
|
|
570
597
|
label?: string,
|
|
571
598
|
): LorasVar<T> => new LorasVar(options, initial, label),
|
|
572
|
-
size: (defaultValue?: SizeValue, opts: { presets?: SizePreset[]; label?: string } = {}): SizeVar =>
|
|
573
|
-
new SizeVar(defaultValue, opts.presets, opts.label),
|
|
599
|
+
size: (defaultValue?: SizeValue, opts: { presets?: SizePreset[]; label?: string; image?: ImageVar } = {}): SizeVar =>
|
|
600
|
+
new SizeVar(defaultValue, opts.presets, opts.label, opts.image),
|
|
574
601
|
image: (defaultValue: string, opts: ImageVarOpts = {}): ImageVar => new ImageVar(defaultValue, opts),
|
|
575
602
|
}
|
|
576
603
|
|
|
@@ -582,11 +609,13 @@ export const v = {
|
|
|
582
609
|
export type AnyVar = {
|
|
583
610
|
readonly kind: VarKind
|
|
584
611
|
readonly value: unknown
|
|
612
|
+
readonly defaultValue: unknown
|
|
585
613
|
readonly label?: string
|
|
586
614
|
/** the vars-spec key — DefinedWorkflow writes it at define time */
|
|
587
615
|
name?: string
|
|
588
616
|
parse(raw: string): boolean
|
|
589
617
|
loadJSON(value: unknown): unknown
|
|
618
|
+
reset(): unknown
|
|
590
619
|
toJSON(): unknown
|
|
591
620
|
outValue(): unknown
|
|
592
621
|
display(): string
|
|
@@ -37,6 +37,9 @@ export type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
|
37
37
|
export type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
38
38
|
/** short id; also names the workflow instances */
|
|
39
39
|
id?: string
|
|
40
|
+
/** optional TUI tree color (ink color name or hex); unset = the tree's
|
|
41
|
+
* per-family palette (first `-` word of the module basename) */
|
|
42
|
+
color?: string
|
|
40
43
|
/** the tweakable knobs; drivers (scripts, TUI) edit these between runs.
|
|
41
44
|
* A LAMBDA gives cross-referencing vars a scope (loras + prompt with
|
|
42
45
|
* loraKeywordsFrom created inline) — resolved ONCE at define time, and it
|
|
@@ -94,10 +97,13 @@ export class DefinedWorkflow<ID extends string = string, V extends VarsSpec = Va
|
|
|
94
97
|
* (set by run()) fires each var's afterRun() right after snapshotting the
|
|
95
98
|
* values — atomically, before any await — so the graph uses this run's seed
|
|
96
99
|
* while the var moves to the next (queued runs get distinct seeds; a bare
|
|
97
|
-
* build() for copy/export never advances).
|
|
100
|
+
* build() for copy/export never advances). `p.host` substitutes the host
|
|
101
|
+
* the graph is built against (TUI host override): node/model availability
|
|
102
|
+
* there surfaces as workflow.problems / server validation, by design.
|
|
98
103
|
*/
|
|
99
|
-
async build(p: { advance?: boolean } = {}): Promise<ComfyWorkflow<ID>> {
|
|
100
|
-
const
|
|
104
|
+
async build(p: { advance?: boolean; host?: ComfyHost<ID> } = {}): Promise<ComfyWorkflow<ID>> {
|
|
105
|
+
const host = p.host ?? this.host
|
|
106
|
+
const wf = host.workflow({ id: this.spec.id })
|
|
101
107
|
const values = varValues(this.vars)
|
|
102
108
|
if (p.advance) for (const varDef of Object.values(this.vars)) varDef.afterRun()
|
|
103
109
|
await this.spec.build(wf.builder, values, wf)
|
|
@@ -106,11 +112,18 @@ export class DefinedWorkflow<ID extends string = string, V extends VarsSpec = Va
|
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
/** build a fresh graph from the current var values, send it, wait for outputs.
|
|
109
|
-
* connects first (idempotent) — modules can import offline from the schema cache
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
115
|
+
* connects first (idempotent) — modules can import offline from the schema cache.
|
|
116
|
+
* `settings.host` runs against THAT host instead of the defining one. */
|
|
117
|
+
async run(settings: RunSettings & { host?: ComfyHost<ID> } = {}): Promise<ComfyExecution> {
|
|
118
|
+
const host = settings.host ?? this.host
|
|
119
|
+
await host.connect()
|
|
120
|
+
const wf = await this.build({ advance: true, host })
|
|
121
|
+
const execution = await wf.run({
|
|
122
|
+
saveFormat: settings.saveFormat,
|
|
123
|
+
idMode: settings.idMode,
|
|
124
|
+
log: settings.log,
|
|
125
|
+
onProgress: settings.onProgress,
|
|
126
|
+
})
|
|
114
127
|
this.lastExecution = execution
|
|
115
128
|
return execution
|
|
116
129
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefinedWorkflow-BYyu5dK9.js","names":[],"sources":["../src/utils/log.ts","../src/utils/ansi.ts","../src/utils/extractErrorMessage.ts","../src/vars/loraKeywords.ts","../src/vars/ComfyVars.ts","../src/vars/DefinedWorkflow.ts"],"sourcesContent":["// loud console logging; errors must be observable to human AND LLM.\n// COMFY_TS_QUIET=1 (set by drivers like the TUI) silences INFO chatter only —\n// errors always print.\nexport const isQuiet = (): boolean => process.env.COMFY_TS_QUIET === '1'\nexport const logInfo = (msg: string): void => {\n if (!isQuiet()) console.log(msg)\n}\nexport const logError = (msg: string): void => console.error(`[comfy-ts] 🔴 ${msg}`)\nexport const logSuccess = (msg: string): void => console.log(`[comfy-ts] 🟢 ${msg}`)\n","// tiny chalk-compatible terminal styler (chainable), keeps chalk out of the deps\nconst codes = {\n bold: [1, 22],\n underline: [4, 24],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n greenBright: [92, 39],\n} as const\n\ntype StyleName = keyof typeof codes\nexport type Styler = ((s: string) => string) & { [k in StyleName]: Styler }\n\nfunction styler(open: string = '', close: string = ''): Styler {\n const fn = (s: string): string => open + s + close\n return new Proxy(fn, {\n get(_target, prop: string) {\n const c = codes[prop as StyleName]\n if (c == null) throw new Error(`unknown ansi style: ${prop}`)\n return styler(`${open}\\x1b[${c[0]}m`, `\\x1b[${c[1]}m${close}`)\n },\n }) as Styler\n}\n\nexport const ansi: Styler = styler()\n\n// CSI sequences + lone ESC-letter escapes (server logs re-rendered inside ink)\nconst ANSI_RE = /\\x1b\\[[0-9;?]*[A-Za-z]|\\x1b[A-Za-z]/g\n\nexport function stripAnsi(s: string): string {\n return s.replace(ANSI_RE, '')\n}\n","/** Extracts an error message from an exception stuff. */\nexport const extractErrorMessage = (error: unknown): string => {\n if (error instanceof Error) return error.message\n if (error === null) return 'null'\n if (typeof error === 'string') return error\n if (typeof error === 'object') {\n if ('message' in error && typeof error.message === 'string') return error.message\n return JSON.stringify(error)\n }\n return String(error)\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { observable, runInAction } from 'mobx'\nimport { dirname, join } from 'pathe'\nimport { logError } from 'src/utils/log.ts'\n\n/**\n * hand-assigned trigger keyword(s) per lora name — set via ⌃K in the TUI loras\n * overlay, consumed by PromptVar's `loraKeywordsFrom` prefixing. Persisted at\n * `.comfy-ts/lora-keywords.json` (NOT under cache/: this is hand-entered data\n * and must survive a cache wipe). Observable map: overlay rows re-render on\n * assignment. Keys are the RAW lora names (folder/file.safetensors).\n */\nconst keywords = observable.map<string, string>()\nlet loaded = false\n\nfunction filePath(): string {\n return join(comfyts.baseFolder, 'lora-keywords.json')\n}\n\nfunction loadOnce(): void {\n if (loaded) return\n loaded = true\n const path = filePath()\n if (!existsSync(path)) return\n try {\n const raw: unknown = JSON.parse(readFileSync(path, 'utf8'))\n if (raw == null || typeof raw !== 'object') return\n runInAction(() => {\n for (const [name, kw] of Object.entries(raw)) if (typeof kw === 'string') keywords.set(name, kw)\n })\n } catch (e) {\n logError(`[loraKeywords] unreadable ${path}: ${String(e)}`)\n }\n}\n\nexport function getLoraKeyword(name: string): string {\n loadOnce()\n return keywords.get(name) ?? ''\n}\n\n/** empty keyword deletes the entry; every set writes the file (tiny, rare) */\nexport function setLoraKeyword(name: string, keyword: string): void {\n loadOnce()\n const trimmed = keyword.trim()\n runInAction(() => {\n if (trimmed === '') keywords.delete(name)\n else keywords.set(name, trimmed)\n })\n const path = filePath()\n try {\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, JSON.stringify(Object.fromEntries([...keywords.entries()].sort()), null, 2))\n } catch (e) {\n logError(`[loraKeywords] write failed ${path}: ${String(e)}`)\n }\n}\n","// Vars: the standard \"tweak & re-run\" contract. A workflow defined via\n// host.defineWorkflow({ vars, build }) rebuilds its graph from current var\n// values on every run — drivers (scripts, the TUI) edit vars between runs.\nimport { homedir } from 'node:os'\nimport { action, makeObservable, observable } from 'mobx'\nimport { isAbsolute, join, resolve } from 'pathe'\nimport { getLoraKeyword } from 'src/vars/loraKeywords.ts'\n\nexport type VarKind = 'text' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' | 'image'\n\n/**\n * full base: T is what's STORED/edited, Out what the GRAPH consumes at build\n * time. They usually coincide — extend `ComfyVar<T>` for that. PromptVar is\n * the one Out-specialized var (string in, PromptValue out); the split keeps\n * outValue() cast-free.\n */\nexport abstract class ComfyVarBase<T, Out> {\n abstract readonly kind: VarKind\n /** the vars-spec key, stamped by DefinedWorkflow at define time — error messages name the var with it */\n name?: string\n value: T\n constructor(\n public readonly defaultValue: T,\n public label?: string,\n ) {\n this.value = defaultValue\n // observable value: the TUI (mobx) re-renders when drivers mutate vars.\n // explicit makeObservable (not makeAutoObservable): base-class + subclass\n // combo. All mutators funnel through set()/reset()/parse() so they are\n // actions — subclass helpers call this.set(...) rather than assigning.\n makeObservable(this, { value: observable, set: action, reset: action, parse: action, loadJSON: action })\n }\n set(value: T): this {\n this.value = value\n return this\n }\n /** what drafts persist for this var (subclasses may add fields, e.g. seed mode) */\n toJSON(): unknown {\n return this.value\n }\n /** what the GRAPH consumes at build time (varValues maps these return types) */\n abstract outValue(): Out\n /**\n * restore a value produced by toJSON() (drafts). The cast is sanctioned:\n * drafts are our own round-trip, subclasses re-validate via set().\n */\n loadJSON(value: unknown): this {\n return this.set(value as T)\n }\n reset(): this {\n this.value = this.defaultValue\n return this\n }\n /** parse a raw string (TUI text input) into this var's value; returns false when invalid */\n abstract parse(raw: string): boolean\n /** how the value renders in a var list */\n display(): string {\n return String(this.value)\n }\n /** the string the inline editor starts from (round-trips through parse) */\n toEditBuffer(): string {\n return String(this.value)\n }\n /** hook run after every DefinedWorkflow.run() (default no-op; SeedVar advances) */\n afterRun(): void {}\n}\n\n/** the standard var: the graph consumes the stored value AS-IS (Out = T) */\nexport abstract class ComfyVar<T> extends ComfyVarBase<T, T> {\n outValue(): T {\n return this.value\n }\n}\n\nexport class TextVar extends ComfyVar<string> {\n readonly kind = 'text' as const\n parse(raw: string): boolean {\n this.set(raw)\n return true\n }\n}\n\nconst commentLineRe = /^\\s*\\/\\//\nconst negativeLineRe = /^\\s*- (.*)$/\n\n/** what PromptVar needs from a loras var: covariant face, so LorasVar<'a'|'b'> fits */\nexport type ActiveLoraSource = { activeNames(): string[] }\n\n/** what a prompt CONTRIBUTES to build: `vars.prompt.positive` / `.negative` */\nexport type PromptValue = { positive: string; negative: string }\n\n/**\n * prompt text with editor comforts, all resolved at BUILD time (the editor and\n * drafts keep the raw text):\n * - `//` lines are COMMENTS — stripped\n * - `- ` lines are NEGATIVE prompt lines — removed from `.positive`,\n * comma-joined into `.negative`\n * - with `loraKeywordsFrom`, the ACTIVE loras' hand-assigned keywords\n * (src/vars/loraKeywords.ts, ⌃K in the TUI) prefix `.positive` —\n * `injectedKeywords()` is public so the TUI can PREVIEW the injection.\n */\nexport class PromptVar extends ComfyVarBase<string, PromptValue> {\n readonly kind = 'text' as const\n constructor(\n defaultValue: string,\n public promptOpts: { label?: string; loraKeywordsFrom?: ActiveLoraSource } = {},\n ) {\n super(defaultValue, promptOpts.label)\n }\n parse(raw: string): boolean {\n this.set(raw)\n return true\n }\n static isCommentLine(line: string): boolean {\n return commentLineRe.test(line)\n }\n static isNegativeLine(line: string): boolean {\n return negativeLineRe.test(line)\n }\n /** the keyword prefix the flag will inject (deduped, lora-list order) — the TUI previews this */\n injectedKeywords(): string[] {\n const src = this.promptOpts.loraKeywordsFrom\n if (src == null) return []\n return [\n ...new Set(\n src\n .activeNames()\n .map(getLoraKeyword)\n .filter((k) => k !== ''),\n ),\n ]\n }\n outValue(): PromptValue {\n const pos: string[] = []\n const neg: string[] = []\n for (const line of this.value.split('\\n')) {\n if (commentLineRe.test(line)) continue\n const m = negativeLineRe.exec(line)\n if (m != null) {\n const text = (m[1] ?? '').trim()\n if (text !== '') neg.push(text)\n } else pos.push(line)\n }\n const body = pos.join('\\n').trim()\n const keywords = this.injectedKeywords()\n const positive =\n keywords.length === 0 ? body : body === '' ? keywords.join(', ') : `${keywords.join(', ')}, ${body}`\n return { positive, negative: neg.join(', ') }\n }\n}\n\nexport class IntVar extends ComfyVar<number> {\n readonly kind = 'int' as const\n constructor(\n defaultValue: number,\n public opts: { min?: number; max?: number; label?: string } = {},\n ) {\n super(defaultValue, opts.label)\n }\n override set(value: number): this {\n const clamped = Math.round(Math.min(this.opts.max ?? Infinity, Math.max(this.opts.min ?? -Infinity, value)))\n return super.set(clamped)\n }\n parse(raw: string): boolean {\n const n = Number(raw)\n if (Number.isNaN(n)) return false\n this.set(n)\n return true\n }\n}\n\nexport class FloatVar extends ComfyVar<number> {\n readonly kind = 'float' as const\n constructor(\n defaultValue: number,\n public opts: { min?: number; max?: number; label?: string } = {},\n ) {\n super(defaultValue, opts.label)\n }\n override set(value: number): this {\n return super.set(Math.min(this.opts.max ?? Infinity, Math.max(this.opts.min ?? -Infinity, value)))\n }\n parse(raw: string): boolean {\n const n = Number(raw)\n if (Number.isNaN(n)) return false\n this.set(n)\n return true\n }\n}\n\n/** '=' fixed · '+' increment each run · '-' decrement each run · '?' reroll each run */\nexport type SeedMode = '=' | '+' | '-' | '?'\n\n/**\n * a seed is a MODE + a number. `value` stays a plain number (what the graph\n * consumes); `mode` decides how it advances after each run (afterRun()):\n * `= 12` fixed · `+ 0` auto-increment · `- 0` auto-decrement · `? 0` random.\n * The number shown is always the seed the NEXT run will use.\n */\nexport class SeedVar extends ComfyVar<number> {\n readonly kind = 'seed' as const\n mode: SeedMode = '='\n constructor(defaultValue: number = 0, label?: string) {\n super(defaultValue, label)\n // subclass-owned observable field (base makeObservable already ran in super)\n makeObservable(this, { mode: observable, setMode: action, randomize: action, advance: action })\n }\n setMode(mode: SeedMode): this {\n this.mode = mode\n return this\n }\n randomize(): this {\n return this.set(Math.floor(Math.random() * 2 ** 32))\n }\n override set(value: number): this {\n // seeds are unsigned: clamp at 0 so decrement can't go negative\n return super.set(Math.max(0, Math.floor(value)))\n }\n /** move the seed to what the NEXT run should use, per mode */\n advance(): this {\n if (this.mode === '+') return this.set(this.value + 1)\n if (this.mode === '-') return this.set(this.value - 1)\n if (this.mode === '?') return this.randomize()\n return this // '=' stays fixed\n }\n override afterRun(): void {\n this.advance()\n }\n /** parse `+` `- 12` `= 5` `?` or a bare number (=> fixed). Keeps the current number when none given */\n parse(raw: string): boolean {\n const m = raw.trim().match(/^([+\\-=?])?\\s*(\\d+)?$/)\n if (m == null) return false\n const modeChar = m[1]\n const numStr = m[2]\n if (modeChar == null && numStr == null) return false\n this.setMode(modeChar == null ? '=' : (modeChar as SeedMode))\n if (numStr != null) this.set(Number(numStr))\n return true\n }\n override display(): string {\n return `${this.mode} ${this.value}`\n }\n override toEditBuffer(): string {\n return `${this.mode} ${this.value}`\n }\n override toJSON(): unknown {\n return { mode: this.mode, value: this.value }\n }\n override loadJSON(value: unknown): this {\n if (typeof value === 'number') return this.set(value) // legacy plain-number drafts\n if (value != null && typeof value === 'object') {\n const o = value as { mode?: unknown; value?: unknown }\n if (o.mode === '=' || o.mode === '+' || o.mode === '-' || o.mode === '?') this.setMode(o.mode)\n if (typeof o.value === 'number') this.set(o.value)\n }\n return this\n }\n}\n\nexport class ToggleVar extends ComfyVar<boolean> {\n readonly kind = 'toggle' as const\n toggle(): this {\n return this.set(!this.value)\n }\n parse(raw: string): boolean {\n if (raw !== 'true' && raw !== 'false') return false\n this.set(raw === 'true')\n return true\n }\n override display(): string {\n return this.value ? 'ON' : 'OFF'\n }\n}\n\nexport class ChoiceVar<T extends string> extends ComfyVar<T> {\n readonly kind = 'choice' as const\n constructor(\n public readonly choices: readonly T[],\n defaultValue: T,\n label?: string,\n ) {\n super(defaultValue, label)\n }\n next(delta: number = 1): this {\n const ix = this.choices.indexOf(this.value)\n const nextIx = (ix + delta + this.choices.length) % this.choices.length\n return this.set(this.choices[nextIx] ?? this.value)\n }\n parse(raw: string): boolean {\n const hit = this.choices.find((c) => c === raw)\n if (hit == null) return false\n this.set(hit)\n return true\n }\n}\n\n/**\n * per-lora setting: false = off, true = 1/1, number = both strengths,\n * [strength_model, strength_clip] = each explicitly\n */\nexport type LoraStrength = boolean | number | [strengthModel: number, strengthClip: number]\n\nexport type ActiveLora<T extends string> = { lora_name: T; strength_model: number; strength_clip: number }\n\n/** normalize a loras record into what a standard LoraLoader chain consumes */\nexport function activeLoras<T extends string>(loras: Partial<Record<T, LoraStrength>>): ActiveLora<T>[] {\n const out: ActiveLora<T>[] = []\n for (const [lora_name, s] of Object.entries(loras) as [T, LoraStrength | undefined][]) {\n if (s == null || s === false) continue\n const [strength_model, strength_clip] = Array.isArray(s) ? s : s === true ? [1, 1] : [s, s]\n out.push({ lora_name, strength_model, strength_clip })\n }\n return out\n}\n\n/** what LorasVar.bindHost needs — structural, so ComfyVars never imports ComfyHost */\nexport type LorasHost = { schema: { getLoras(filter?: RegExp): string[] } }\n\n/**\n * multi-select lora stack over a DYNAMIC options list — a RegExp resolves\n * against the host's loras at define time (DefinedWorkflow calls bindHost),\n * or feed it host discovery (`host.schema.getLoras(regex?)`) directly; never\n * a hardcoded inventory. Selection is empty by default.\n */\nexport class LorasVar<T extends string> extends ComfyVar<Partial<Record<T, LoraStrength>>> {\n readonly kind = 'loras' as const\n /** last non-false strength per lora, so untick → re-tick restores it */\n private prev: Partial<Record<T, LoraStrength>> = {}\n /** a RegExp source resolves lazily (bindHost) — null until then */\n private resolvedOptions: readonly T[] | null = null\n\n constructor(\n private readonly optionsSource: readonly T[] | RegExp,\n initial: Partial<Record<T, LoraStrength>> = {},\n label?: string,\n ) {\n super(initial, label)\n }\n\n get options(): readonly T[] {\n if (!(this.optionsSource instanceof RegExp)) return this.optionsSource\n if (this.resolvedOptions == null)\n throw new Error(\n `v.loras(${String(this.optionsSource)}) is host-bound — it only works inside defineWorkflow({ vars }) (pass a name list otherwise)`,\n )\n return this.resolvedOptions\n }\n\n /** DefinedWorkflow binds the host at define time: a RegExp source resolves here.\n * cast: whitelist family 1 (agent/coding.md) — getLoras() returns the runtime\n * values of the SAME object_info enum the generated E_LoraName union comes from */\n bindHost(host: LorasHost): void {\n if (!(this.optionsSource instanceof RegExp)) return\n this.resolvedOptions = host.schema.getLoras(this.optionsSource) as T[]\n }\n\n get names(): T[] {\n return [...this.options]\n }\n\n /** loras currently ON (PromptVar keyword prefixing consumes this) */\n activeNames(): T[] {\n return this.names.filter((n) => this.isOn(n))\n }\n\n isOn(name: T): boolean {\n const s = this.value[name]\n return s != null && s !== false\n }\n\n toggleItem(name: T): this {\n const cur = this.value[name]\n if (cur == null || cur === false) return this.set({ ...this.value, [name]: this.prev[name] ?? true })\n this.prev[name] = cur\n return this.set({ ...this.value, [name]: false })\n }\n\n /** step both strengths by delta (true becomes 1 first); no-op when off */\n adjustItem(name: T, delta: number): this {\n const cur = this.value[name]\n if (cur == null || cur === false) return this\n const step = (n: number): number => Math.max(0, Math.round((n + delta) * 100) / 100)\n const next: LoraStrength = Array.isArray(cur) ? [step(cur[0]), step(cur[1])] : step(cur === true ? 1 : cur)\n return this.set({ ...this.value, [name]: next })\n }\n\n /** compact per-item strength label for lists */\n strengthLabel(name: T): string {\n const s = this.value[name]\n if (s == null || s === false) return ''\n if (s === true) return '1.00'\n if (Array.isArray(s)) return `m:${s[0].toFixed(2)} c:${s[1].toFixed(2)}`\n return s.toFixed(2)\n }\n\n parse(raw: string): boolean {\n try {\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed == null || Array.isArray(parsed)) return false\n this.set(parsed as Partial<Record<T, LoraStrength>>)\n return true\n } catch {\n return false\n }\n }\n\n /** short human name: subfolder + extension stripped */\n static shortName(name: string): string {\n return (name.split(/[\\\\/]/).pop() ?? name).replace(/\\.safetensors$/, '')\n }\n\n /** tick (true) or untick (false) every lora in `names` (default: all options) */\n setAll(on: boolean, names: readonly T[] = this.options): this {\n const next = { ...this.value }\n for (const name of names) {\n const cur = next[name]\n if (on) {\n if (cur == null || cur === false) next[name] = this.prev[name] ?? true\n } else {\n if (cur != null && cur !== false) this.prev[name] = cur\n next[name] = false\n }\n }\n return this.set(next)\n }\n\n override display(): string {\n const on = this.activeNames()\n if (on.length === 0) return `(0/${this.options.length}) none`\n return `(${on.length}/${this.options.length}) ${on.map((n) => LorasVar.shortName(n)).join(', ')}`\n }\n}\n\nexport type SizeValue = { width: number; height: number }\nexport type SizePreset = { label: string; width: number; height: number }\n\n/** SDXL-style ~1MP buckets, multiples of 64 — safe for most latent models */\nexport const DEFAULT_SIZE_PRESETS: SizePreset[] = [\n { label: '1:1 square', width: 1024, height: 1024 },\n { label: '4:3 landscape', width: 1152, height: 896 },\n { label: '3:4 portrait', width: 896, height: 1152 },\n { label: '3:2 landscape', width: 1216, height: 832 },\n { label: '2:3 portrait', width: 832, height: 1216 },\n { label: '16:9 widescreen', width: 1344, height: 768 },\n { label: '9:16 tall', width: 768, height: 1344 },\n]\n\n/** width/height picker: presets + free `WxH` entry */\nexport class SizeVar extends ComfyVar<SizeValue> {\n readonly kind = 'size' as const\n constructor(\n defaultValue: SizeValue = { width: 1024, height: 1024 },\n public readonly presets: SizePreset[] = DEFAULT_SIZE_PRESETS,\n label?: string,\n ) {\n super(defaultValue, label)\n }\n\n /** accepts '1024x768' / '1024×768' / a preset label */\n parse(raw: string): boolean {\n const m = raw.trim().match(/^(\\d+)\\s*[x×]\\s*(\\d+)$/)\n if (m != null) {\n this.set({ width: Number(m[1]), height: Number(m[2]) })\n return true\n }\n const preset = this.presets.find((p) => p.label === raw.trim())\n if (preset != null) {\n this.set({ width: preset.width, height: preset.height })\n return true\n }\n return false\n }\n\n override display(): string {\n const { width, height } = this.value\n const hit = this.presets.find((p) => p.width === width && p.height === height)\n return `${width}×${height}${hit ? ` (${hit.label})` : ''}`\n }\n}\n\nexport type ImageVarOpts = {\n /** where the TUI picker starts browsing AND what relative values resolve against (absPath) */\n folder?: string\n /** picker listing filter, lowercase without dots; never affects the value */\n extensions?: readonly string[]\n label?: string\n}\n\nexport const DEFAULT_IMAGE_EXTENSIONS: readonly string[] = ['png', 'jpg', 'jpeg', 'webp', 'gif']\n\n/** empty image var consumed at build time — typed so drivers surface it apart from real crashes */\nexport class ImageVarEmptyError extends Error {\n constructor(public readonly varName: string) {\n super(`image var '${varName}' is empty — pick a file (TUI: activate the var; script: .set('/path/to/image.png'))`)\n }\n}\n\n/** trim + expand a leading `~/` — every ImageVar write funnels through this */\nfunction expandUserPath(raw: string): string {\n const trimmed = raw.trim()\n return trimmed.startsWith('~/') ? join(homedir(), trimmed.slice(2)) : trimmed\n}\n\n/**\n * a local image path. The VALUE is a PLAIN PATH STRING — text-encodable,\n * drafts persist it verbatim (toJSON = the string), hand-editable in the\n * draft json. Empty = unset: outValue()/absPath() throw ImageVarEmptyError,\n * so a build never runs on a silent placeholder. The TUI opens the image\n * picker overlay for kind 'image'.\n */\nexport class ImageVar extends ComfyVar<string> {\n readonly kind = 'image' as const\n constructor(\n defaultValue: string,\n public opts: ImageVarOpts = {},\n ) {\n super(expandUserPath(defaultValue), opts.label)\n }\n /** what the picker lists (lowercase, no dots) */\n get extensions(): readonly string[] {\n return this.opts.extensions ?? DEFAULT_IMAGE_EXTENSIONS\n }\n override set(value: string): this {\n return super.set(expandUserPath(value))\n }\n parse(raw: string): boolean {\n this.set(raw)\n return true\n }\n isSet(): boolean {\n return this.value !== ''\n }\n private emptyError(): ImageVarEmptyError {\n return new ImageVarEmptyError(this.name ?? this.label ?? 'image')\n }\n /** the ONE resolution helper: absolute kept as-is, relative resolved against opts.folder, else cwd */\n absPath(): string {\n if (!this.isSet()) throw this.emptyError()\n if (isAbsolute(this.value)) return this.value\n return resolve(this.opts.folder ?? process.cwd(), this.value)\n }\n /** empty = unset: the build fails LOUD here (varValues calls outValue) */\n override outValue(): string {\n if (!this.isSet()) throw this.emptyError()\n return this.value\n }\n override display(): string {\n if (!this.isSet()) return '(unset) pick a file'\n const home = homedir()\n return this.value.startsWith(`${home}/`) ? `~${this.value.slice(home.length)}` : this.value\n }\n}\n\n/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image */\nexport const v = {\n text: (defaultValue: string, label?: string): TextVar => new TextVar(defaultValue, label),\n prompt: (defaultValue: string, opts: { label?: string; loraKeywordsFrom?: ActiveLoraSource } = {}): PromptVar =>\n new PromptVar(defaultValue, opts),\n int: (defaultValue: number, opts: { min?: number; max?: number; label?: string } = {}): IntVar =>\n new IntVar(defaultValue, opts),\n float: (defaultValue: number, opts: { min?: number; max?: number; label?: string } = {}): FloatVar =>\n new FloatVar(defaultValue, opts),\n seed: (defaultValue: number = 0, label?: string): SeedVar => new SeedVar(defaultValue, label),\n toggle: (defaultValue: boolean, label?: string): ToggleVar => new ToggleVar(defaultValue, label),\n choice: <const T extends string>(choices: readonly T[], defaultValue: T, label?: string): ChoiceVar<T> =>\n new ChoiceVar(choices, defaultValue, label),\n loras: <T extends string = string>(\n options: readonly T[] | RegExp,\n initial: Partial<Record<T, LoraStrength>> = {},\n label?: string,\n ): LorasVar<T> => new LorasVar(options, initial, label),\n size: (defaultValue?: SizeValue, opts: { presets?: SizePreset[]; label?: string } = {}): SizeVar =>\n new SizeVar(defaultValue, opts.presets, opts.label),\n image: (defaultValue: string, opts: ImageVarOpts = {}): ImageVar => new ImageVar(defaultValue, opts),\n}\n\n/**\n * structural face of any var: readonly `value` keeps ComfyVar<T> assignable\n * despite T-invariance on the mutable field. VarValues re-derives the exact\n * value types via infer.\n */\nexport type AnyVar = {\n readonly kind: VarKind\n readonly value: unknown\n readonly label?: string\n /** the vars-spec key — DefinedWorkflow writes it at define time */\n name?: string\n parse(raw: string): boolean\n loadJSON(value: unknown): unknown\n toJSON(): unknown\n outValue(): unknown\n display(): string\n toEditBuffer(): string\n afterRun(): void\n /** host-dependent vars (LorasVar regex) resolve here — DefinedWorkflow calls it at define time */\n bindHost?(host: LorasHost): void\n}\n\nexport type VarsSpec = { [key: string]: AnyVar }\n\nexport type VarValues<V extends VarsSpec> = {\n // outValue() return type, not the stored type: PromptVar stores string, contributes PromptValue\n [K in keyof V]: V[K] extends { outValue(): infer O } ? O : never\n}\n\nexport function varValues<V extends VarsSpec>(vars: V): VarValues<V> {\n const out: Record<string, unknown> = {}\n // outValue, not value: PromptVar strips comments / prefixes lora keywords here\n for (const [k, varDef] of Object.entries(vars)) out[k] = varDef.outValue()\n return out as VarValues<V>\n}\n","import type { ComfyHost } from 'src/host/ComfyHost.ts'\nimport type { ComfyExecution } from 'src/runner/ComfyExecution.ts'\nimport type { ComfyWorkflow, RunSettings } from 'src/runner/ComfyWorkflow.ts'\nimport type { SdkForHost } from 'src/types/comfy-sdk.ts'\nimport {\n type AnyVar,\n type LorasVar,\n type LoraStrength,\n v,\n type VarsSpec,\n type VarValues,\n varValues,\n} from 'src/vars/ComfyVars.ts'\n\n/** the host's generated lora-name union (plain string when no sdk is generated) */\nexport type LoraNameOf<ID extends string> = 'E_LoraName' extends keyof SdkForHost<ID>['Union']\n ? SdkForHost<ID>['Union']['E_LoraName'] & string\n : string\n\n/**\n * the `v` handed to a vars LAMBDA: the global factory, host-typed —\n * `v.loras(regex)` yields the host's lora-name union (resolved via bindHost)\n */\nexport type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {\n loras(\n options: RegExp,\n initial?: Partial<Record<LoraNameOf<ID>, LoraStrength>>,\n label?: string,\n ): LorasVar<LoraNameOf<ID>>\n loras<T extends string>(\n options: readonly T[],\n initial?: Partial<Record<T, LoraStrength>>,\n label?: string,\n ): LorasVar<T>\n}\n\nexport type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {\n /** short id; also names the workflow instances */\n id?: string\n /** the tweakable knobs; drivers (scripts, TUI) edit these between runs.\n * A LAMBDA gives cross-referencing vars a scope (loras + prompt with\n * loraKeywordsFrom created inline) — resolved ONCE at define time, and it\n * RECEIVES the host-typed `v` (no import needed) */\n vars: V | ((v: BoundVars<ID>) => V)\n /** builds the graph from the CURRENT var values; re-executed on every run().\n * may be async (e.g. image uploads through the wf param) */\n build: (b: SdkForHost<ID>['Builder'], vars: VarValues<V>, wf: ComfyWorkflow<ID>) => void | Promise<void>\n}\n\n/** type predicate (not a cast): a VarsSpec is a plain record, never callable */\nfunction isVarsThunk<ID extends string, V extends VarsSpec>(\n vars: V | ((v: BoundVars<ID>) => V),\n): vars is (v: BoundVars<ID>) => V {\n return typeof vars === 'function'\n}\n\n/**\n * a re-runnable workflow definition: `build` re-executes per run with the\n * current var values, so every run gets a fresh, deterministic graph.\n */\nexport class DefinedWorkflow<ID extends string = string, V extends VarsSpec = VarsSpec> {\n /** spec.vars resolved once (may be given as a thunk) — the SAME instances for the workflow's lifetime */\n readonly vars: V\n\n constructor(\n public host: ComfyHost<ID>,\n public spec: DefineWorkflowSpec<ID, V>,\n ) {\n // cast: whitelist family 1 (agent/coding.md) — the runtime `v` IS the\n // factory BoundVars describes; the regex-loras typing claim it adds is\n // resolved from the same object_info enum via bindHost below\n this.vars = isVarsThunk(spec.vars) ? spec.vars(v as BoundVars<ID>) : spec.vars\n // define-time var wiring: the spec key becomes the var's name (error\n // messages name the var with it), host-dependent vars (v.loras(regex))\n // resolve their options\n for (const [key, varDef] of this.entries()) {\n varDef.name = key\n varDef.bindHost?.(this.host)\n }\n }\n\n /** [name, var] pairs, for drivers that enumerate the knobs */\n entries(): [string, AnyVar][] {\n return Object.entries(this.vars)\n }\n\n /** the workflow built by the latest run() (null before the first run) */\n lastWorkflow: ComfyWorkflow<ID> | null = null\n /** the latest execution (null before the first run) */\n lastExecution: ComfyExecution | null = null\n\n /**\n * build a fresh graph from the CURRENT var values (no send). `p.advance`\n * (set by run()) fires each var's afterRun() right after snapshotting the\n * values — atomically, before any await — so the graph uses this run's seed\n * while the var moves to the next (queued runs get distinct seeds; a bare\n * build() for copy/export never advances).\n */\n async build(p: { advance?: boolean } = {}): Promise<ComfyWorkflow<ID>> {\n const wf = this.host.workflow({ id: this.spec.id })\n const values = varValues(this.vars)\n if (p.advance) for (const varDef of Object.values(this.vars)) varDef.afterRun()\n await this.spec.build(wf.builder, values, wf)\n this.lastWorkflow = wf\n return wf\n }\n\n /** build a fresh graph from the current var values, send it, wait for outputs.\n * connects first (idempotent) — modules can import offline from the schema cache */\n async run(settings: RunSettings = {}): Promise<ComfyExecution> {\n await this.host.connect()\n const wf = await this.build({ advance: true })\n const execution = await wf.run(settings)\n this.lastExecution = execution\n return execution\n }\n}\n"],"mappings":";;;;;AAGA,MAAa,gBAAyB,QAAQ,IAAI,mBAAmB;AACrE,MAAa,WAAW,QAAsB;CAC3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,GAAG;AAClC;AACA,MAAa,YAAY,QAAsB,QAAQ,MAAM,iBAAiB,KAAK;AACnF,MAAa,cAAc,QAAsB,QAAQ,IAAI,iBAAiB,KAAK;;;ACPnF,MAAM,QAAQ;CACX,MAAM,CAAC,GAAG,EAAE;CACZ,WAAW,CAAC,GAAG,EAAE;CACjB,KAAK,CAAC,IAAI,EAAE;CACZ,OAAO,CAAC,IAAI,EAAE;CACd,QAAQ,CAAC,IAAI,EAAE;CACf,MAAM,CAAC,IAAI,E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