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.
- package/README.md +20 -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 +7 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +284 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -7
- package/dist/index.d.ts +125 -7
- package/dist/index.js +282 -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-JxlEbb_f.js → run-tui-BPw-SZYW.js} +106 -157
- package/dist/run-tui-BPw-SZYW.js.map +1 -0
- package/dist/serve-web.js +432 -72
- package/dist/{state-CaHeDL-0.js → state-B-boDz-Z.js} +180 -45
- package/dist/state-B-boDz-Z.js.map +1 -0
- package/dist/web.d.ts +109 -7
- package/dist/web.js +235 -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 +3 -0
- 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 +3 -1
- package/src/cli/serve/ServeApp.ts +754 -40
- 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 +35 -38
- package/src/cli/serve/serveSettings.ts +86 -0
- package/src/cli/serve/startupPrint.ts +111 -0
- package/src/cli/serve/web/api.ts +97 -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 +12 -9
- package/src/cli/serve/web/components/Sidebar.tsx +43 -19
- package/src/cli/serve/web/components/VarsForm.tsx +440 -91
- 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 +1 -1
- package/src/cli/serve/web/logWeb.ts +6 -0
- package/src/cli/serve/web/state/EnhancerSt.ts +8 -15
- package/src/cli/serve/web/state/FormSt.ts +66 -17
- package/src/cli/serve/web/state/RunSt.ts +22 -1
- package/src/cli/serve/web/state/WebSt.ts +518 -14
- 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 +413 -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/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-D1Tsuru9.js +0 -1162
- package/dist/run-serve-D1Tsuru9.js.map +0 -1
- package/dist/run-tui-JxlEbb_f.js.map +0 -1
- package/dist/state-CaHeDL-0.js.map +0 -1
- package/src/cli/serve/promptEnhancers.ts +0 -69
- package/src/cli/serve/safeName.ts +0 -12
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// the master prompts of the web ui's prompt enhancer, as FILES:
|
|
2
|
-
// `.comfy-ts/prompt-enhancers/<name>.md`, the drafts model applied to prose.
|
|
3
|
-
// Markdown, not json: these are hand-edited paragraphs, and a json string field
|
|
4
|
-
// would be one escaped line. The FILENAME is the identity (a rename is a write
|
|
5
|
-
// plus a delete); validStoreName is the same gate the draft routes use.
|
|
6
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
7
|
-
import { join } from 'pathe'
|
|
8
|
-
import { validStoreName } from 'src/cli/serve/safeName.ts'
|
|
9
|
-
|
|
10
|
-
const EXT = '.md'
|
|
11
|
-
|
|
12
|
-
export type PromptEnhancer = { name: string; text: string }
|
|
13
|
-
|
|
14
|
-
export function promptEnhancersDir(): string {
|
|
15
|
-
return comfyts.resolveFromPromptEnhancers('')
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function promptEnhancerPath(name: string): string | null {
|
|
19
|
-
const safe = validStoreName(name)
|
|
20
|
-
return safe == null ? null : join(promptEnhancersDir(), `${safe}${EXT}`)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** the shipped starting point. It is a FILE from the first read on, so it can be edited
|
|
24
|
-
* on disk like everything else — the browser ships no copy of this text */
|
|
25
|
-
const SEED: PromptEnhancer = {
|
|
26
|
-
name: 'refine-krea2-prompt',
|
|
27
|
-
text: `You rewrite image prompts for krea2 turbo, a distilled 8 step text to image model whose text encoder reads flowing natural language, not tag soup, and which is steered by adjectives rather than by negatives.
|
|
28
|
-
|
|
29
|
-
Rewrite the user's prompt into ONE dense paragraph someone could picture with their eyes closed:
|
|
30
|
-
- keep every noun and every named subject the user wrote, they are the point
|
|
31
|
-
- add what is missing to make it fun to look at: lighting, palette, material, texture, camera angle, composition, mood
|
|
32
|
-
- prefer concrete visual nouns over praise, never write "masterpiece", "8k", "highly detailed", "award winning"
|
|
33
|
-
- stay under about 80 words, no lists, no headings, no quotes around the result
|
|
34
|
-
- keep any "// " comment line and any "- " negative line from the input verbatim, each on its own line
|
|
35
|
-
|
|
36
|
-
Answer with the rewritten prompt and nothing else: no preamble, no explanation.
|
|
37
|
-
`,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** seeds ONCE, on an absent folder. A folder he emptied on purpose stays empty */
|
|
41
|
-
export function listPromptEnhancers(): PromptEnhancer[] {
|
|
42
|
-
const dir = promptEnhancersDir()
|
|
43
|
-
if (!existsSync(dir)) writePromptEnhancer(SEED.name, SEED.text)
|
|
44
|
-
if (!existsSync(dir)) return []
|
|
45
|
-
const out: PromptEnhancer[] = []
|
|
46
|
-
for (const file of readdirSync(dir).sort()) {
|
|
47
|
-
if (!file.endsWith(EXT)) continue
|
|
48
|
-
const name = file.slice(0, -EXT.length)
|
|
49
|
-
if (validStoreName(name) == null) continue
|
|
50
|
-
out.push({ name, text: readFileSync(join(dir, file), 'utf8') })
|
|
51
|
-
}
|
|
52
|
-
return out
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function writePromptEnhancer(name: string, text: string): string | null {
|
|
56
|
-
const path = promptEnhancerPath(name)
|
|
57
|
-
if (path == null) return null
|
|
58
|
-
mkdirSync(promptEnhancersDir(), { recursive: true })
|
|
59
|
-
writeFileSync(path, text)
|
|
60
|
-
return path
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** a missing file is still a success: the caller asked for it to be gone, and it is */
|
|
64
|
-
export function deletePromptEnhancer(name: string): boolean {
|
|
65
|
-
const path = promptEnhancerPath(name)
|
|
66
|
-
if (path == null) return false
|
|
67
|
-
if (existsSync(path)) rmSync(path)
|
|
68
|
-
return true
|
|
69
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// THE name gate for every serve route that turns a url segment into a file path.
|
|
2
|
-
// SECURITY-CRITICAL and deliberately shared: handle() decodes per segment, so
|
|
3
|
-
// `%2F` arrives as a real `/` while the segment count still looks right. One
|
|
4
|
-
// function, because a second regex somewhere else is a second traversal hole.
|
|
5
|
-
|
|
6
|
-
/** the accepted name, or null. Rejects traversal, absolute paths, leading dots and empties */
|
|
7
|
-
export function validStoreName(raw: string): string | null {
|
|
8
|
-
const name = raw.trim()
|
|
9
|
-
// length cap: past it the fs answers ENAMETOOLONG as a raw 500
|
|
10
|
-
if (name.length > 100) return null
|
|
11
|
-
return /^[\w][\w .-]*$/.test(name) ? name : null
|
|
12
|
-
}
|