comfy-ts 1.0.0 → 1.2.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 +60 -11
- package/dist/cli.js +4 -4439
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +445 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7439 -340
- package/dist/index.d.ts +7457 -358
- package/dist/index.js +444 -172
- package/dist/index.js.map +1 -1
- package/dist/{run-tui-BFhba_oG.js → run-tui-BAdizWsO.js} +1244 -201
- package/dist/run-tui-BAdizWsO.js.map +1 -0
- package/dist/state-BYbxDgfr.js +5258 -0
- package/dist/state-BYbxDgfr.js.map +1 -0
- package/examples/README.md +32 -0
- package/examples/comfy-cloud/ace-step-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/anima-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/boogu-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/capybara-i2i.cflow.ts +85 -0
- package/examples/comfy-cloud/capybara-i2v.cflow.ts +90 -0
- package/examples/comfy-cloud/capybara-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/chroma-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/cloudHost.ts +41 -0
- package/examples/comfy-cloud/ernie-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/firered-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/flux1-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/flux1-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/flux2-i2i.cflow.ts +80 -0
- package/examples/comfy-cloud/flux2-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/hidream-i2i.cflow.ts +89 -0
- package/examples/comfy-cloud/hidream-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +93 -0
- package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +74 -0
- package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +80 -0
- package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +95 -0
- package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +60 -0
- package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/krea2-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/lens-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/longcat-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/longcat-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/ltxv-i2v.cflow.ts +92 -0
- package/examples/comfy-cloud/ltxv-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/newbie-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +86 -0
- package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/ovis-t2i.cflow.ts +56 -0
- package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +69 -0
- package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +55 -0
- package/examples/comfy-cloud/sd35-t2i.cflow.ts +48 -0
- package/examples/comfy-cloud/sdk.d.ts +445 -57
- package/examples/comfy-cloud/sdxl-t2i.cflow.ts +69 -0
- package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +53 -0
- package/examples/comfy-cloud/svd-i2v.cflow.ts +75 -0
- package/examples/comfy-cloud/wan21-i2v.cflow.ts +83 -0
- package/examples/comfy-cloud/wan21-t2v.cflow.ts +64 -0
- package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +69 -0
- package/examples/comfy-cloud/wan22-i2v.cflow.ts +107 -0
- package/examples/comfy-cloud/wan22-t2v.cflow.ts +98 -0
- package/examples/comfy-cloud/z-image-t2i.cflow.ts +62 -0
- package/examples/images/README.md +18 -0
- package/examples/images/bear_1024x1024.jpg +0 -0
- package/examples/images/deer_768x1344.jpg +0 -0
- package/examples/images/dog_512x512.jpg +0 -0
- package/examples/images/lioness_768x768.jpg +0 -0
- package/examples/images/pug_200x300.jpg +0 -0
- package/examples/images/walrus_1344x768.jpg +0 -0
- 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} +7 -18
- 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/rvion/05-comfy-cloud.cflow.ts +51 -0
- package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
- package/guide-for-agents.md +7 -1
- package/package.json +18 -4
- 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/PreviewPanel.tsx +9 -8
- package/src/cli/tui/components/StatusBar.tsx +39 -9
- package/src/cli/tui/components/TreePanel.tsx +17 -7
- package/src/cli/tui/components/TuiApp.tsx +65 -5
- package/src/cli/tui/discoverWorkflows.ts +7 -41
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +72 -0
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +288 -0
- package/src/cli/tui/imagePicker/fsListing.ts +48 -0
- package/src/cli/tui/imagePicker/pickerPrefs.ts +78 -0
- package/src/cli/tui/run-tui.tsx +49 -8
- package/src/cli/tui/state/DraftsSt.ts +3 -2
- package/src/cli/tui/state/ExecSt.ts +108 -12
- package/src/cli/tui/state/HostSt.ts +94 -10
- package/src/cli/tui/state/LorasSt.ts +14 -36
- package/src/cli/tui/state/PickerSt.ts +8 -2
- package/src/cli/tui/state/PreviewSt.ts +28 -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 +139 -36
- package/src/cli/tui/state/TuiSt.ts +53 -6
- package/src/cli/tui/state/WorkflowsSt.ts +14 -2
- package/src/cli/tui/treeRows.ts +165 -0
- package/src/exampleAssets.ts +56 -0
- package/src/graph/ComfyNode.ts +4 -1
- package/src/host/ComfyHost.ts +7 -0
- package/src/index.ts +7 -0
- package/src/manager/ComfyRegistry.ts +37 -9
- package/src/manager/generated/KnownComfyCustomNodeName.ts +23852 -1926
- package/src/manager/generated/KnownComfyPluginTitle.ts +6854 -236
- package/src/manager/generated/KnownComfyPluginURL.ts +3425 -111
- package/src/manager/generated/KnownModel_Base.ts +23 -7
- package/src/manager/generated/KnownModel_FileName.ts +421 -0
- package/src/manager/generated/KnownModel_Name.ts +421 -0
- package/src/manager/generated/KnownModel_SavePath.ts +34 -8
- package/src/manager/generated/KnownModel_Type.ts +18 -14
- package/src/manager/json/alter-list.json +221 -221
- package/src/manager/json/custom-node-list.json +61020 -21946
- package/src/manager/json/extension-node-map.json +81077 -31176
- package/src/manager/json/github-stats.json +29321 -12601
- package/src/manager/json/model-list.json +5935 -4997
- package/src/manager/loaders/parseReport.ts +55 -0
- package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +15 -49
- package/src/manager/loaders/step2_custom-node-list-loader.ts +38 -83
- package/src/manager/loaders/step3_extension-node-map-loader.ts +36 -142
- package/src/manager/loaders/step4_model-list-loader.ts +25 -36
- package/src/manager/loaders/step5_alter-list-loader.ts +29 -0
- package/src/manager/loaders/step6_github-stats-loader.ts +23 -0
- package/src/manager/script-update-manager.bun.ts +9 -1
- package/src/manager/types/ComfyManagerAlterInfo.ts +13 -0
- package/src/manager/types/ComfyManagerFileModelInfo.ts +7 -3
- package/src/manager/types/ComfyManagerFilePluginContent.ts +6 -9
- package/src/manager/types/ComfyManagerFilePluginList.ts +3 -3
- package/src/manager/types/ComfyManagerGithubStats.ts +9 -0
- package/src/manager/types/ComfyManagerPluginContentMetadata.ts +2 -3
- package/src/manager/types/ComfyManagerPluginInfo.ts +48 -34
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/sdk-generator/ComfySchema.ts +14 -1
- package/src/sdk-generator/comfyui-sdk-codegen.ts +15 -0
- package/src/sdk-generator/inputWidgetKind.ts +17 -0
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +106 -5
- package/src/vars/DefinedWorkflow.ts +28 -10
- package/dist/DefinedWorkflow-O3ynII3Y.js +0 -598
- package/dist/DefinedWorkflow-O3ynII3Y.js.map +0 -1
- package/dist/run-tui-BFhba_oG.js.map +0 -1
- package/examples/05-comfy-cloud.cflow.ts +0 -67
- package/src/utils/tryExtracting.ts +0 -41
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// z-image t2i on Comfy Cloud — Z-Image Turbo bf16, 8-step distilled text to image (cfg 1)
|
|
2
|
+
// source template: image_z_image_turbo.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/z-image-t2i.cflow.ts ["prompt"] [seed]
|
|
5
|
+
import { v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
export const zImageT2i = host.defineWorkflow({
|
|
11
|
+
id: 'z-image-t2i',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
'Latina female with thick wavy hair, harbor boats and pastel houses behind. Breezy seaside light, warm tones, cinematic close-up.',
|
|
16
|
+
),
|
|
17
|
+
seed: v.seed(42),
|
|
18
|
+
steps: v.int(8, { min: 1, max: 40 }),
|
|
19
|
+
size: v.size({ width: 1024, height: 1024 }),
|
|
20
|
+
},
|
|
21
|
+
build: (b, vars) => {
|
|
22
|
+
const model = b.ModelSamplingAuraFlow({
|
|
23
|
+
model: b.UNETLoader({ unet_name: 'z_image_turbo_bf16.safetensors', weight_dtype: 'default' }),
|
|
24
|
+
shift: 3,
|
|
25
|
+
})
|
|
26
|
+
const clip = b.CLIPLoader({ clip_name: 'qwen_3_4b.safetensors', type: 'lumina2', device: 'default' })
|
|
27
|
+
const positive = b.CLIPTextEncode({ clip, text: vars.prompt.positive })
|
|
28
|
+
// turbo distill: no negative lines → zeroed-out conditioning (the template's own default)
|
|
29
|
+
const negative =
|
|
30
|
+
vars.prompt.negative === ''
|
|
31
|
+
? b.ConditioningZeroOut({ conditioning: positive })
|
|
32
|
+
: b.CLIPTextEncode({ clip, text: vars.prompt.negative })
|
|
33
|
+
const samples = b.KSampler({
|
|
34
|
+
model,
|
|
35
|
+
positive,
|
|
36
|
+
negative,
|
|
37
|
+
latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
38
|
+
seed: vars.seed,
|
|
39
|
+
steps: vars.steps,
|
|
40
|
+
cfg: 1,
|
|
41
|
+
sampler_name: 'res_multistep',
|
|
42
|
+
scheduler: 'simple',
|
|
43
|
+
denoise: 1,
|
|
44
|
+
})
|
|
45
|
+
b.SaveImage({
|
|
46
|
+
images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'ae.safetensors' }) }),
|
|
47
|
+
filename_prefix: 'comfy-ts-zoo/z-image-t2i',
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export default zImageT2i
|
|
53
|
+
|
|
54
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
55
|
+
if (import.meta.main) {
|
|
56
|
+
requireCloudKey()
|
|
57
|
+
if (process.argv[2]) zImageT2i.vars.prompt.set(process.argv[2])
|
|
58
|
+
if (process.argv[3]) zImageT2i.vars.seed.set(Number(process.argv[3]))
|
|
59
|
+
const execution = await zImageT2i.run({ log: true })
|
|
60
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
61
|
+
host.disconnect()
|
|
62
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Bundled example input images
|
|
2
|
+
|
|
3
|
+
Default inputs for the i2i/i2v examples — they ship in the npm tarball so
|
|
4
|
+
every example runs out of the box. The exact pixel size is in each filename.
|
|
5
|
+
|
|
6
|
+
Source: [picsum.photos](https://picsum.photos), which serves Unsplash-sourced
|
|
7
|
+
photos, free to use. Fetched and re-encoded (jpeg q80, metadata stripped) by
|
|
8
|
+
`scripts/fetch-example-images.ts` — the manifest in that script is the source
|
|
9
|
+
of truth; regeneration is deliberate (`bun run examples:images`).
|
|
10
|
+
|
|
11
|
+
| file | size | picsum id | author |
|
|
12
|
+
| --------------------- | --------- | ------------------------------------------ | ------------------------------------------------------------ |
|
|
13
|
+
| `dog_512x512.jpg` | 512×512 | [237](https://picsum.photos/id/237/info) | [André Spieker](https://unsplash.com/photos/8wTPqxlnKM4) |
|
|
14
|
+
| `lioness_768x768.jpg` | 768×768 | [1074](https://picsum.photos/id/1074/info) | [Samuel Scrimshaw](https://unsplash.com/photos/sseiVD2XsOk) |
|
|
15
|
+
| `bear_1024x1024.jpg` | 1024×1024 | [433](https://picsum.photos/id/433/info) | [Thomas Lefebvre](https://unsplash.com/photos/aRXPJnXQ9lU) |
|
|
16
|
+
| `walrus_1344x768.jpg` | 1344×768 | [1084](https://picsum.photos/id/1084/info) | [Jay Ruzesky](https://unsplash.com/photos/h13Y8vyIXNU) |
|
|
17
|
+
| `deer_768x1344.jpg` | 768×1344 | [1003](https://picsum.photos/id/1003/info) | [E+N Photographies](https://unsplash.com/photos/GYumuBnTqKc) |
|
|
18
|
+
| `pug_200x300.jpg` | 200×300 | [1025](https://picsum.photos/id/1025/info) | [Matthew Wiebe](https://unsplash.com/photos/U5rMrSI7Pn4) |
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// generate an image from text, fully typed against the 'windows-1' host sdk
|
|
2
|
-
// run directly: bun examples/01-txt2img.cflow.ts ["prompt"] [seed]
|
|
2
|
+
// run directly: bun examples/rvion/01-txt2img.cflow.ts ["prompt"] [seed]
|
|
3
3
|
// in the TUI: bun run tui (scans **/*.cflow.ts, tweak vars, r to run)
|
|
4
4
|
import { ComfyTS, v } from 'comfy-ts'
|
|
5
5
|
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
// upload a local image (hash-named, deduped) and run img2img on it
|
|
2
|
-
// run directly: bun examples/02-img2img-upload.cflow.ts [path/to/image.png]
|
|
3
|
-
// in the TUI: bun run tui — the `image` var
|
|
4
|
-
import {
|
|
5
|
-
import { asAbsolutePath, ComfyTS, MediaImage, v } from 'comfy-ts'
|
|
6
|
-
import { dirname, resolve } from 'pathe'
|
|
7
|
-
import sharp from 'sharp'
|
|
2
|
+
// run directly: bun examples/rvion/02-img2img-upload.cflow.ts [path/to/image.png]
|
|
3
|
+
// in the TUI: bun run tui — activate the `image` var to open the picker (browse, favorites, preview)
|
|
4
|
+
import { asAbsolutePath, ComfyTS, exampleImagePath, MediaImage, v } from 'comfy-ts'
|
|
8
5
|
|
|
9
6
|
const comfy = ComfyTS.create()
|
|
10
7
|
const host = comfy.host({ id: 'windows-1', host: 'desktop-im18794', port: 8085 })
|
|
11
8
|
await host.loadSchemaFromCache() // offline import; run() connects lazily
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (path.trim() !== '') return resolve(path)
|
|
16
|
-
const placeholder = comfy.resolveFromOutput('example-input.png')
|
|
17
|
-
mkdirSync(dirname(placeholder), { recursive: true })
|
|
18
|
-
await sharp({ create: { width: 512, height: 512, channels: 3, background: { r: 210, g: 140, b: 80 } } })
|
|
19
|
-
.png()
|
|
20
|
-
.toFile(placeholder)
|
|
21
|
-
return placeholder
|
|
22
|
-
}
|
|
10
|
+
// bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
|
|
11
|
+
const image = v.image(exampleImagePath('dog_512x512.jpg'))
|
|
23
12
|
|
|
24
13
|
export const img2img = host.defineWorkflow({
|
|
25
14
|
id: 'img2img-upload',
|
|
26
15
|
vars: {
|
|
27
|
-
image
|
|
16
|
+
image,
|
|
28
17
|
prompt: v.text('oil painting of a sunset over the sea'),
|
|
29
18
|
negative: v.text('text, watermark'),
|
|
30
19
|
seed: v.seed(7),
|
|
@@ -34,7 +23,7 @@ export const img2img = host.defineWorkflow({
|
|
|
34
23
|
},
|
|
35
24
|
// async build: the input image is uploaded (hash-named, deduped) per run
|
|
36
25
|
build: async (b, vars, wf) => {
|
|
37
|
-
const img = new MediaImage({ path: asAbsolutePath(
|
|
26
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
38
27
|
const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
|
|
39
28
|
|
|
40
29
|
const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'SD1.5\\v1-5-pruned-emaonly.ckpt' })
|
package/examples/{03-export-workflow-json.cflow.ts → rvion/03-export-workflow-json.cflow.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// build a graph OFFLINE (schema from .comfy-ts/ cache) and export both ComfyUI
|
|
2
2
|
// JSON formats: api.json (prompt) + workflow.json (readable litegraph, autolayouted)
|
|
3
|
-
// run directly: bun examples/03-export-workflow-json.cflow.ts (no server needed)
|
|
3
|
+
// run directly: bun examples/rvion/03-export-workflow-json.cflow.ts (no server needed)
|
|
4
4
|
// in the TUI: bun run tui — r runs it live (PreviewImage), c/C copy the JSONs
|
|
5
5
|
import { mkdirSync, writeFileSync } from 'node:fs'
|
|
6
6
|
import { ComfyTS, v } from 'comfy-ts'
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// (rabbits-vs-sheeps "unified"). krea2 turbo UNET + standard LoraLoader chain
|
|
3
3
|
// → KSampler(8 steps, cfg 1) → RMBG cutout → transparent png game sprite.
|
|
4
4
|
//
|
|
5
|
-
// run directly: bun examples/04-krea2-turbo-t2i.cflow.ts ["prompt"] [seed]
|
|
6
|
-
// in the TUI: bun src/cli/comfy-ts-cli.ts tui examples/04-krea2-turbo-t2i.cflow.ts
|
|
5
|
+
// run directly: bun examples/rvion/04-krea2-turbo-t2i.cflow.ts ["prompt"] [seed]
|
|
6
|
+
// in the TUI: bun src/cli/comfy-ts-cli.ts tui examples/rvion/04-krea2-turbo-t2i.cflow.ts
|
|
7
7
|
// tui browser: bun src/cli/comfy-ts-cli.ts tui examples/ (scans **/*.cflow.ts)
|
|
8
8
|
import { activeLoras, ComfyTS } from 'comfy-ts'
|
|
9
9
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// sd15 t2i on Comfy Cloud — the reference zoo example (agent/examples.md)
|
|
2
|
+
// source template: default.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers) — loads fine without, run() needs it
|
|
4
|
+
// run directly: bun examples/rvion/05-comfy-cloud.cflow.ts ["prompt"] [seed]
|
|
5
|
+
import { v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from '../comfy-cloud/cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
export const sd15T2i = host.defineWorkflow({
|
|
11
|
+
id: 'sd15-t2i',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt('a lighthouse on a cliff at dusk, dramatic clouds\n- blurry, low quality'),
|
|
15
|
+
seed: v.seed(42),
|
|
16
|
+
steps: v.int(12, { min: 1, max: 60 }),
|
|
17
|
+
cfg: v.float(7, { min: 0, max: 30 }),
|
|
18
|
+
size: v.size({ width: 512, height: 512 }),
|
|
19
|
+
},
|
|
20
|
+
build: (b, vars) => {
|
|
21
|
+
const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'v1-5-pruned-emaonly-fp16.safetensors' })
|
|
22
|
+
const samples = b.KSampler({
|
|
23
|
+
model: ckpt,
|
|
24
|
+
positive: b.CLIPTextEncode({ clip: ckpt, text: vars.prompt.positive }),
|
|
25
|
+
negative: b.CLIPTextEncode({ clip: ckpt, text: vars.prompt.negative }),
|
|
26
|
+
latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
27
|
+
seed: vars.seed,
|
|
28
|
+
steps: vars.steps,
|
|
29
|
+
cfg: vars.cfg,
|
|
30
|
+
sampler_name: 'euler',
|
|
31
|
+
scheduler: 'normal',
|
|
32
|
+
denoise: 1,
|
|
33
|
+
})
|
|
34
|
+
b.SaveImage({ images: b.VAEDecode({ samples, vae: ckpt }), filename_prefix: 'comfy-ts-zoo/sd15-t2i' })
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export default sd15T2i
|
|
39
|
+
|
|
40
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
41
|
+
if (import.meta.main) {
|
|
42
|
+
requireCloudKey()
|
|
43
|
+
if (process.argv[2]) sd15T2i.vars.prompt.set(process.argv[2])
|
|
44
|
+
if (process.argv[3]) sd15T2i.vars.seed.set(Number(process.argv[3]))
|
|
45
|
+
|
|
46
|
+
const t0 = Date.now()
|
|
47
|
+
const execution = await sd15T2i.run({ log: true })
|
|
48
|
+
console.log(`🟢 done in ${((Date.now() - t0) / 1000).toFixed(1)}s — ${execution.images.length} image(s):`)
|
|
49
|
+
for (const img of execution.images) console.log(` ${img.absPath} (${img.width}x${img.height})`)
|
|
50
|
+
host.disconnect()
|
|
51
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// qwen image edit 2511 on windows-1 — instruction-driven image editing
|
|
2
|
+
// mirrors the official image_qwen_image_edit_2511 template, single reference
|
|
3
|
+
// image; the lightning toggle switches the 4-step Lightning lora (cfg 1) vs
|
|
4
|
+
// full sampling (cfg 4 — raise steps to ~40 yourself when you flip it off)
|
|
5
|
+
// run directly: bun examples/rvion/06-qwen-image-edit.cflow.ts [path/to/image.png] ["edit instruction"]
|
|
6
|
+
import { asAbsolutePath, ComfyTS, exampleImagePath, MediaImage, v } from 'comfy-ts'
|
|
7
|
+
|
|
8
|
+
const comfy = ComfyTS.create()
|
|
9
|
+
const host = comfy.host({ id: 'windows-1', host: 'desktop-im18794', port: 8085 })
|
|
10
|
+
await host.loadSchemaFromCache() // offline import; run() connects lazily
|
|
11
|
+
|
|
12
|
+
// bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
|
|
13
|
+
const image = v.image(exampleImagePath('bear_1024x1024.jpg'))
|
|
14
|
+
|
|
15
|
+
export const qwenImageEdit = host.defineWorkflow({
|
|
16
|
+
id: 'qwen-image-edit',
|
|
17
|
+
vars: {
|
|
18
|
+
image,
|
|
19
|
+
// `- ` lines are the negative prompt (template default: empty negative encode)
|
|
20
|
+
prompt: v.prompt('turn this photo into a detailed watercolor painting'),
|
|
21
|
+
seed: v.seed(42),
|
|
22
|
+
steps: v.int(4, { min: 1, max: 60 }),
|
|
23
|
+
lightning: v.toggle(true, '4-step lightning lora'),
|
|
24
|
+
prefix: v.text('qwen-image-edit'),
|
|
25
|
+
},
|
|
26
|
+
// async build: the reference image is uploaded (hash-named, deduped) per run
|
|
27
|
+
build: async (b, vars, wf) => {
|
|
28
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
29
|
+
const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
|
|
30
|
+
const scaled = b.FluxKontextImageScale({ image: loaded })
|
|
31
|
+
|
|
32
|
+
const unet = b.UNETLoader({ unet_name: 'qwen_image_edit_2511_bf16.safetensors', weight_dtype: 'default' })
|
|
33
|
+
const clip = b.CLIPLoader({
|
|
34
|
+
clip_name: 'qwen_2.5_vl_7b_fp8_scaled.safetensors',
|
|
35
|
+
type: 'qwen_image',
|
|
36
|
+
device: 'default',
|
|
37
|
+
})
|
|
38
|
+
const vae = b.VAELoader({ vae_name: 'qwen_image_vae.safetensors' })
|
|
39
|
+
|
|
40
|
+
let model = b.CFGNorm({
|
|
41
|
+
model: b.ModelSamplingAuraFlow({ model: unet, shift: 3.1 }),
|
|
42
|
+
strength: 1,
|
|
43
|
+
pre_cfg: false,
|
|
44
|
+
})._MODEL
|
|
45
|
+
if (vars.lightning) {
|
|
46
|
+
model = b.LoraLoaderModelOnly({
|
|
47
|
+
model,
|
|
48
|
+
lora_name: 'Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors',
|
|
49
|
+
strength_model: 1,
|
|
50
|
+
})._MODEL
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// both branches carry the reference through the kontext latent method (template shape)
|
|
54
|
+
const positive = b.FluxKontextMultiReferenceLatentMethod({
|
|
55
|
+
reference_latents_method: 'index_timestep_zero',
|
|
56
|
+
conditioning: b.TextEncodeQwenImageEditPlus({ clip, prompt: vars.prompt.positive, vae, image1: scaled }),
|
|
57
|
+
})
|
|
58
|
+
const negative = b.FluxKontextMultiReferenceLatentMethod({
|
|
59
|
+
reference_latents_method: 'index_timestep_zero',
|
|
60
|
+
conditioning: b.TextEncodeQwenImageEditPlus({ clip, prompt: vars.prompt.negative, vae, image1: scaled }),
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const samples = b.KSampler({
|
|
64
|
+
model,
|
|
65
|
+
positive,
|
|
66
|
+
negative,
|
|
67
|
+
latent_image: b.VAEEncode({ pixels: scaled, vae }),
|
|
68
|
+
seed: vars.seed,
|
|
69
|
+
steps: vars.steps,
|
|
70
|
+
cfg: vars.lightning ? 1 : 4,
|
|
71
|
+
sampler_name: 'euler',
|
|
72
|
+
scheduler: 'simple',
|
|
73
|
+
denoise: 1,
|
|
74
|
+
})
|
|
75
|
+
b.SaveImage({ images: b.VAEDecode({ samples, vae }), filename_prefix: vars.prefix })
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
export default qwenImageEdit
|
|
80
|
+
|
|
81
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
82
|
+
if (import.meta.main) {
|
|
83
|
+
if (process.argv[2]) qwenImageEdit.vars.image.set(process.argv[2])
|
|
84
|
+
if (process.argv[3]) qwenImageEdit.vars.prompt.set(process.argv[3])
|
|
85
|
+
|
|
86
|
+
const execution = await qwenImageEdit.run({ log: true })
|
|
87
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
88
|
+
host.disconnect()
|
|
89
|
+
}
|
package/guide-for-agents.md
CHANGED
|
@@ -83,7 +83,7 @@ if (import.meta.main) {
|
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
Var kinds: `v.text`, `v.int`, `v.float`, `v.seed`, `v.toggle`, `v.choice`,
|
|
86
|
-
`v.size`, `v.loras`, `v.prompt`. Notes:
|
|
86
|
+
`v.size`, `v.loras`, `v.prompt`, `v.image`. Notes:
|
|
87
87
|
|
|
88
88
|
- `v.loras(/regex/)` resolves against the host's real lora list;
|
|
89
89
|
`activeLoras(vars.loras)` returns `{ lora_name, strength_model, strength_clip }[]`
|
|
@@ -91,6 +91,12 @@ Var kinds: `v.text`, `v.int`, `v.float`, `v.seed`, `v.toggle`, `v.choice`,
|
|
|
91
91
|
- `v.prompt` is structured: `//` lines are comments (stripped), `- ` lines go
|
|
92
92
|
to the negative prompt, `{ loraKeywordsFrom: lorasVar }` prefixes lora
|
|
93
93
|
trigger keywords. The value is `{ positive, negative }`.
|
|
94
|
+
- `v.image` holds a local image path as a plain string; an empty value throws
|
|
95
|
+
at build time instead of running a silent placeholder. Capture the var in a
|
|
96
|
+
const and call `image.absPath()` in `build`. Default it to a bundled sample
|
|
97
|
+
with `exampleImagePath('bear_1024x1024.jpg')` (ships in the package). In
|
|
98
|
+
the TUI it opens an image picker (browse, favorite folders, recents,
|
|
99
|
+
preview).
|
|
94
100
|
- `vars` may be a lambda `(v) => ({ ... })` so vars can reference each other.
|
|
95
101
|
- `build` may be async, for uploads: the third param `wf` feeds `MediaImage`
|
|
96
102
|
helpers (`new MediaImage({ path }).loadInWorkflow_viaLoadImageNode(wf)`).
|
package/package.json
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comfy-ts",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "The complete TypeScript toolkit for ComfyUI and generative AI. Fully type-safe SDK with autocomplete on every node, companion CLI, TUI, agentic docs, and 50+ examples. Design, run and deploy creative pipelines for image, video, audio, 3d and text on any ComfyUI, local, cloud or hosted.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"comfyui",
|
|
7
|
-
"
|
|
7
|
+
"generative-ai",
|
|
8
8
|
"typescript",
|
|
9
|
+
"type-safe",
|
|
10
|
+
"sdk",
|
|
9
11
|
"codegen",
|
|
10
|
-
"
|
|
12
|
+
"image-generation",
|
|
13
|
+
"video-generation",
|
|
14
|
+
"audio-generation",
|
|
15
|
+
"3d",
|
|
16
|
+
"stable-diffusion",
|
|
17
|
+
"flux",
|
|
18
|
+
"workflow",
|
|
19
|
+
"cli",
|
|
20
|
+
"tui"
|
|
11
21
|
],
|
|
12
22
|
"author": "Rémi Vion <vion.remi@gmail.com>",
|
|
13
23
|
"license": "MIT",
|
|
24
|
+
"funding": "https://github.com/sponsors/rvion",
|
|
14
25
|
"repository": {
|
|
15
26
|
"type": "git",
|
|
16
27
|
"url": "https://github.com/rvion/comfy-ts.git"
|
|
@@ -67,9 +78,12 @@
|
|
|
67
78
|
"gen:sdk": "bun scripts/gen-sdk-from-cache.ts",
|
|
68
79
|
"gen:sdk:cloud": "bun src/cli/comfy-ts-cli.ts gen --id comfy-cloud --host https://cloud.comfy.org --out examples/comfy-cloud/sdk.d.ts && oxfmt examples/comfy-cloud/sdk.d.ts",
|
|
69
80
|
"sdk:outline": "bun scripts/sdk-outline.ts",
|
|
81
|
+
"examples:images": "bun scripts/fetch-example-images.ts",
|
|
70
82
|
"templates:fetch": "bun scripts/fetch-templates.ts",
|
|
71
83
|
"templates:check": "bun scripts/check-templates.ts",
|
|
72
84
|
"hooks:install": "git config core.hooksPath .githooks",
|
|
85
|
+
"release": "bun scripts/release.ts",
|
|
86
|
+
"release:dry": "bun scripts/release.ts --dry-run",
|
|
73
87
|
"prepublishOnly": "bun run ci && bun run build",
|
|
74
88
|
"tui": "bun src/cli/comfy-ts-cli.ts tui"
|
|
75
89
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Box, Text } from 'ink'
|
|
2
|
+
import { observer } from 'mobx-react-lite'
|
|
3
|
+
import { KeyHints } from 'src/cli/tui/components/StatusBar.tsx'
|
|
4
|
+
import type { TuiSt } from 'src/cli/tui/state/TuiSt.ts'
|
|
5
|
+
|
|
6
|
+
/** `c`/`C` confirmation popup: WHAT landed in the clipboard (or the loud
|
|
7
|
+
* failure) — a copy is never silent again. ⏎/esc closes. */
|
|
8
|
+
export const CopyOverlay = observer((p: { st: TuiSt }) => {
|
|
9
|
+
const popup = p.st.exec.copyPopup
|
|
10
|
+
if (popup == null) return null
|
|
11
|
+
return (
|
|
12
|
+
<Box borderStyle="double" borderColor={popup.ok ? 'green' : 'red'} paddingX={1} flexDirection="column">
|
|
13
|
+
<Text bold color={popup.ok ? 'green' : 'red'}>
|
|
14
|
+
{popup.ok ? '✓ ' : '✗ '}
|
|
15
|
+
{popup.title}
|
|
16
|
+
</Text>
|
|
17
|
+
{popup.lines.slice(0, p.st.overlayLines).map((line, ix) => (
|
|
18
|
+
<Text key={`${ix}·${line.slice(0, 12)}`} color={popup.ok ? undefined : 'red'} wrap="truncate">
|
|
19
|
+
{line}
|
|
20
|
+
</Text>
|
|
21
|
+
))}
|
|
22
|
+
<KeyHints hints={[['⏎/esc', 'close']]} />
|
|
23
|
+
</Box>
|
|
24
|
+
)
|
|
25
|
+
})
|
|
@@ -15,9 +15,10 @@ const HeaderBox = (p: { title?: string; children: ReactNode }): ReactNode => (
|
|
|
15
15
|
</Box>
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
-
/** labeled header boxes: brand · (w)orkflow · (d)raft · (h)ost — the keys open each surface */
|
|
18
|
+
/** labeled header boxes: brand · (w)orkflow · (d)raft · (h)ost·(a)ctions — the keys open each surface */
|
|
19
19
|
export const Header = observer((p: { st: TuiSt }) => {
|
|
20
20
|
const s = p.st
|
|
21
|
+
const runHost = s.runHost
|
|
21
22
|
return (
|
|
22
23
|
<Box flexDirection="row">
|
|
23
24
|
<HeaderBox>
|
|
@@ -35,16 +36,20 @@ export const Header = observer((p: { st: TuiSt }) => {
|
|
|
35
36
|
{s.drafts.active ?? 'default'}
|
|
36
37
|
</Text>
|
|
37
38
|
</HeaderBox>
|
|
38
|
-
<HeaderBox title="(h)ost">
|
|
39
|
+
<HeaderBox title="(h)ost · (a)ctions">
|
|
39
40
|
<Text>
|
|
40
41
|
<Text color={s.host.status === 'up' ? 'green' : s.host.status === 'down' ? 'red' : 'gray'}>● </Text>
|
|
41
42
|
<Text bold color="green">
|
|
42
|
-
{
|
|
43
|
+
{runHost.data.id}
|
|
43
44
|
</Text>
|
|
44
45
|
<Text color="gray">
|
|
45
46
|
{' '}
|
|
46
|
-
({
|
|
47
|
+
({runHost.base.host}:{runHost.base.port})
|
|
47
48
|
</Text>
|
|
49
|
+
{/* the override must stay loud: every run bypasses the workflow's own host */}
|
|
50
|
+
{s.hostOverride != null && s.hostOverride !== s.wf.host && (
|
|
51
|
+
<Text color="yellow"> ⇄ overrides {s.wf.host.data.id}</Text>
|
|
52
|
+
)}
|
|
48
53
|
{/* while down, show the probe loop living: spinner in flight, countdown between tries */}
|
|
49
54
|
{s.host.status === 'down' && (
|
|
50
55
|
<Text color="red"> {s.host.probing ? s.host.spinner : `↻ ${s.host.retryInS}s`}</Text>
|
|
@@ -9,10 +9,11 @@ export const HostPanel = observer((p: { st: TuiSt }) => {
|
|
|
9
9
|
return (
|
|
10
10
|
<Box borderStyle="double" paddingX={1} flexDirection="column">
|
|
11
11
|
<Text bold>
|
|
12
|
-
host · <Text color="green">{h.host.data.id}</Text>{' '}
|
|
12
|
+
host actions · <Text color="green">{h.host.data.id}</Text>{' '}
|
|
13
13
|
<Text color="gray">
|
|
14
|
-
({h.host.
|
|
14
|
+
({h.host.base.host}:{h.host.base.port})
|
|
15
15
|
</Text>
|
|
16
|
+
{s.hostOverride != null && <Text color="yellow"> ⇄ override</Text>}
|
|
16
17
|
</Text>
|
|
17
18
|
{h.stats.map((row) => (
|
|
18
19
|
<Text key={row.label}>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Text } from 'ink'
|
|
2
|
+
import { observer } from 'mobx-react-lite'
|
|
3
|
+
import { OverlayList } from 'src/cli/tui/components/OverlayList.tsx'
|
|
4
|
+
import type { TuiSt } from 'src/cli/tui/state/TuiSt.ts'
|
|
5
|
+
|
|
6
|
+
/** modal host picker (`h`): row 0 restores the workflow's own host, the rest
|
|
7
|
+
* override where runs are built and sent (every registered host is listed) */
|
|
8
|
+
export const HostsOverlay = observer((p: { st: TuiSt }) => {
|
|
9
|
+
const s = p.st
|
|
10
|
+
const h = s.host
|
|
11
|
+
const rows = h.pickerRows.map((row, ix) => ({
|
|
12
|
+
key: row.host?.data.id ?? '·default·',
|
|
13
|
+
node: (
|
|
14
|
+
<Text key={row.host?.data.id ?? '·default·'} inverse={ix === h.pickerIx}>
|
|
15
|
+
{ix === h.pickerIx ? '▸ ' : ' '}
|
|
16
|
+
{row.active ? '● ' : ' '}
|
|
17
|
+
{row.label}
|
|
18
|
+
</Text>
|
|
19
|
+
),
|
|
20
|
+
}))
|
|
21
|
+
return (
|
|
22
|
+
<OverlayList
|
|
23
|
+
title={
|
|
24
|
+
<>
|
|
25
|
+
run host <Text color="gray">· overrides the workflow's configured host</Text>
|
|
26
|
+
</>
|
|
27
|
+
}
|
|
28
|
+
selectedIx={h.pickerIx}
|
|
29
|
+
lines={s.overlayLines}
|
|
30
|
+
rows={rows}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
})
|
|
@@ -33,26 +33,27 @@ export const PreviewPanel = observer((p: { st: TuiSt }) => {
|
|
|
33
33
|
)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
// an overlay owns the vars area (loras / image picker): its slot owns the panel too
|
|
37
|
+
const overlayMode = pv.overlayActive
|
|
37
38
|
const running = s.exec.running
|
|
38
39
|
const wantLatent = running && pv.duringRun !== 'last-output'
|
|
39
|
-
const showLatent = !
|
|
40
|
-
const label =
|
|
41
|
-
?
|
|
40
|
+
const showLatent = !overlayMode && wantLatent && (pv.latentAnsi != null || pv.latentBytes != null)
|
|
41
|
+
const label = overlayMode
|
|
42
|
+
? (pv.overlay?.name ?? (s.mode === 'overlay-loras' ? 'lora' : 'image'))
|
|
42
43
|
: showLatent
|
|
43
44
|
? pv.duringRun === 'latent-small'
|
|
44
45
|
? 'latent small'
|
|
45
46
|
: 'latent'
|
|
46
47
|
: 'output'
|
|
47
|
-
const placeholder =
|
|
48
|
-
? (s.loras
|
|
48
|
+
const placeholder = overlayMode
|
|
49
|
+
? (pv.overlay?.note ?? (s.mode === 'overlay-loras' ? '(pick a lora)' : '(pick an image)'))
|
|
49
50
|
: pv.latentsMissing
|
|
50
51
|
? '(no latents from the server — launch comfy with --preview-method auto)'
|
|
51
52
|
: '(no image yet)'
|
|
52
53
|
const content = pv.useNative
|
|
53
54
|
? null
|
|
54
|
-
:
|
|
55
|
-
?
|
|
55
|
+
: overlayMode
|
|
56
|
+
? (pv.overlay?.ansi ?? null)
|
|
56
57
|
: showLatent
|
|
57
58
|
? (pv.latentAnsi ?? pv.outputAnsi)
|
|
58
59
|
: pv.outputAnsi
|
|
@@ -65,6 +65,7 @@ const KIND_KEYS: Record<string, Hint[]> = {
|
|
|
65
65
|
choice: [['⏎/→', 'pick']],
|
|
66
66
|
size: [['⏎/→', 'pick']],
|
|
67
67
|
loras: [['⏎/→', 'select']],
|
|
68
|
+
image: [['⏎/→', 'browse']],
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
/** shown INSIDE the text editor box (TextOverlay footer), not in the keybar */
|
|
@@ -118,12 +119,37 @@ const MODE_KEYS: Partial<Record<string, Hint[]>> = {
|
|
|
118
119
|
['⌃N', 'none'],
|
|
119
120
|
['esc', 'done'],
|
|
120
121
|
],
|
|
122
|
+
'overlay-image': [
|
|
123
|
+
['⏎', 'pick / enter dir'],
|
|
124
|
+
['←', 'parent'],
|
|
125
|
+
['→', 'enter dir'],
|
|
126
|
+
['tab', 'pane'],
|
|
127
|
+
['↑↓', 'move'],
|
|
128
|
+
['type', 'filter'],
|
|
129
|
+
['⌃F', 'fav folder'],
|
|
130
|
+
['esc', 'cancel'],
|
|
131
|
+
],
|
|
121
132
|
'overlay-drafts': [['⏎', 'load / new'], ...DRAFT_OP_HINTS, ['↑↓', 'move'], ['esc', 'cancel']],
|
|
122
|
-
|
|
133
|
+
'overlay-hosts': [
|
|
134
|
+
['⏎', 'pick run host'],
|
|
135
|
+
['↑↓', 'move'],
|
|
136
|
+
['esc', 'cancel'],
|
|
137
|
+
],
|
|
138
|
+
'overlay-copy': [['⏎/esc', 'close']],
|
|
139
|
+
tree: [
|
|
140
|
+
['⏎', 'load'],
|
|
141
|
+
['↑↓', 'move'],
|
|
142
|
+
['←', 'fold'],
|
|
143
|
+
['→', 'unfold / vars'],
|
|
144
|
+
['/', 'filter'],
|
|
145
|
+
...DRAFT_OP_HINTS,
|
|
146
|
+
['t/esc', 'back'],
|
|
147
|
+
],
|
|
123
148
|
host: [
|
|
124
149
|
['⏎', 'run action'],
|
|
125
150
|
['↑↓', 'move'],
|
|
126
|
-
['h
|
|
151
|
+
['h', 'change host'],
|
|
152
|
+
['a/esc', 'back'],
|
|
127
153
|
],
|
|
128
154
|
preview: [
|
|
129
155
|
['←→', 'change'],
|
|
@@ -136,15 +162,19 @@ const MODE_KEYS: Partial<Record<string, Hint[]>> = {
|
|
|
136
162
|
export const KeyBar = observer((p: { st: TuiSt }) => {
|
|
137
163
|
const s = p.st
|
|
138
164
|
const kind = s.selected?.[1].kind
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
[
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
165
|
+
const treeFiltering = s.mode === 'tree' && s.tree.filtering
|
|
166
|
+
const modeHints: Hint[] = treeFiltering
|
|
167
|
+
? [
|
|
168
|
+
['type', 'filter'],
|
|
169
|
+
['⏎', 'load'],
|
|
170
|
+
['↑↓', 'move'],
|
|
171
|
+
['esc', 'clear'],
|
|
172
|
+
]
|
|
173
|
+
: (MODE_KEYS[s.mode] ?? [['↑↓', 'select'], ['←', 'tree'], ...(kind ? (KIND_KEYS[kind] ?? []) : [])])
|
|
174
|
+
// keys already advertised by a panel title (t/v/p) or a header box (w/d/h/a)
|
|
145
175
|
// are NOT repeated here — one letter, one place
|
|
146
176
|
const globalHints: Hint[] =
|
|
147
|
-
s.mode === 'nav' || s.mode === 'tree' || s.mode === 'host' || s.mode === 'preview'
|
|
177
|
+
!treeFiltering && (s.mode === 'nav' || s.mode === 'tree' || s.mode === 'host' || s.mode === 'preview')
|
|
148
178
|
? [
|
|
149
179
|
['r', 'run'],
|
|
150
180
|
['s', 'reroll+run'],
|