@hanzo/studio 0.1.21 → 0.1.23
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/lib/app/director.d.ts +2 -1
- package/lib/app/director.js +51 -47
- package/lib/app/flow-kept.d.ts +22 -0
- package/lib/app/flow-kept.js +32 -0
- package/lib/app/flow.d.ts +6 -9
- package/lib/app/flow.js +50 -138
- package/lib/app/sections.d.ts +1 -3
- package/lib/app/sections.js +1 -8
- package/lib/attach.d.ts +5 -2
- package/lib/attach.js +8 -4
- package/lib/chat/turn.d.ts +3 -0
- package/lib/chat/turn.js +18 -7
- package/lib/desk.js +3 -53
- package/lib/home.d.ts +13 -0
- package/lib/home.js +7 -4
- package/lib/host.d.ts +18 -2
- package/lib/host.js +26 -3
- package/lib/index.d.ts +4 -2
- package/lib/index.js +2 -2
- package/lib/kinds/ad.js +4 -0
- package/lib/kinds/document.d.ts +16 -1
- package/lib/kinds/document.js +20 -7
- package/lib/kinds/image.js +19 -81
- package/lib/kinds/kind.d.ts +5 -2
- package/lib/kinds/mesh/index.js +11 -4
- package/lib/kinds/poster/index.js +6 -0
- package/lib/kinds/sound.d.ts +2 -0
- package/lib/kinds/sound.js +17 -1
- package/lib/kinds/video.d.ts +2 -0
- package/lib/kinds/video.js +26 -136
- package/lib/live.d.ts +3 -2
- package/lib/live.js +10 -3
- package/lib/nav.js +1 -2
- package/lib/places.d.ts +0 -1
- package/lib/places.js +10 -78
- package/lib/route.d.ts +5 -5
- package/lib/route.js +5 -5
- package/lib/spend.d.ts +44 -0
- package/lib/spend.js +68 -0
- package/lib/studio.d.ts +2 -18
- package/lib/studio.js +16 -3
- package/lib/talk.js +20 -9
- package/lib/wire.d.ts +6 -22
- package/lib/wire.js +11 -27
- package/package.json +1 -1
package/lib/app/flow.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SizableText, styled, XStack, YStack } from '@hanzo/gui';
|
|
3
|
-
import { ArrowLeft,
|
|
3
|
+
import { ArrowLeft, Check, ChevronDown, Download, Maximize2, Minus, Play, Plus, Redo2, Undo2, Upload, Wand2, Workflow, } from '@hanzogui/lucide-icons-2';
|
|
4
4
|
import { DropdownMenu } from '@hanzo/ui';
|
|
5
5
|
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import { download } from '../download.js';
|
|
7
7
|
import { reducedMotion, RING } from '../ui.js';
|
|
8
|
-
import {
|
|
8
|
+
import { useSpend } from '../host.js';
|
|
9
9
|
import { BRAIN, useWire } from '../live.js';
|
|
10
|
+
import { alone } from '../spend.js';
|
|
10
11
|
import { complete, objectInfo } from '../wire.js';
|
|
12
|
+
import { keepFlows, keptFlows } from './flow-kept.js';
|
|
11
13
|
import { graphEdit, run, runs } from './flow-run.js';
|
|
12
14
|
const FlowInput = styled(SizableText, {
|
|
13
15
|
name: 'FlowFieldInput',
|
|
@@ -25,21 +27,6 @@ const FlowInput = styled(SizableText, {
|
|
|
25
27
|
color: '$ink',
|
|
26
28
|
focusVisibleStyle: RING,
|
|
27
29
|
});
|
|
28
|
-
const FlowTextarea = styled(SizableText, {
|
|
29
|
-
name: 'FlowFieldTextarea',
|
|
30
|
-
render: 'textarea',
|
|
31
|
-
size: '$2',
|
|
32
|
-
fontFamily: '$mono',
|
|
33
|
-
width: '100%',
|
|
34
|
-
minW: 0,
|
|
35
|
-
p: '$3',
|
|
36
|
-
rounded: '$3',
|
|
37
|
-
borderWidth: 1,
|
|
38
|
-
borderColor: 'var(--border-strong)',
|
|
39
|
-
bg: 'var(--background)',
|
|
40
|
-
color: '$ink',
|
|
41
|
-
focusVisibleStyle: RING,
|
|
42
|
-
});
|
|
43
30
|
const FlowInspectorTextarea = styled(SizableText, {
|
|
44
31
|
name: 'FlowInspectorTextarea',
|
|
45
32
|
render: 'textarea',
|
|
@@ -55,9 +42,7 @@ const FlowInspectorTextarea = styled(SizableText, {
|
|
|
55
42
|
focusVisibleStyle: RING,
|
|
56
43
|
});
|
|
57
44
|
const MULTILINE_INPUT_KEYS = new Set(['input_value', 'system_prompt', 'text', 'instruction', 'prompt', 'lyrics', 'template', 'paths']);
|
|
58
|
-
export { parseFlowSection };
|
|
59
45
|
export function flowNav(host, go) {
|
|
60
|
-
const active = parseFlowSection(host.path);
|
|
61
46
|
return [
|
|
62
47
|
{
|
|
63
48
|
id: 'make',
|
|
@@ -66,38 +51,10 @@ export function flowNav(host, go) {
|
|
|
66
51
|
{
|
|
67
52
|
id: 'canvas',
|
|
68
53
|
label: 'Flow canvas & playground',
|
|
69
|
-
active:
|
|
54
|
+
active: true,
|
|
70
55
|
icon: createElement(Workflow, { size: 16 }),
|
|
71
56
|
onPress: () => go(''),
|
|
72
57
|
},
|
|
73
|
-
{
|
|
74
|
-
id: 'comfy',
|
|
75
|
-
label: 'ComfyUI node extensions',
|
|
76
|
-
active: active === 'comfy',
|
|
77
|
-
icon: createElement(Layers, { size: 16 }),
|
|
78
|
-
onPress: () => go('comfy'),
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: 'agents',
|
|
82
|
-
label: 'Langflow agents, RAG & MCP',
|
|
83
|
-
active: active === 'agents',
|
|
84
|
-
icon: createElement(Boxes, { size: 16 }),
|
|
85
|
-
onPress: () => go('agents'),
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
id: 'code',
|
|
89
|
-
label: 'Python node code editor',
|
|
90
|
-
active: active === 'code',
|
|
91
|
-
icon: createElement(Code, { size: 16 }),
|
|
92
|
-
onPress: () => go('code'),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: 'publish',
|
|
96
|
-
label: 'Publish REST / MCP / JSON',
|
|
97
|
-
active: active === 'publish',
|
|
98
|
-
icon: createElement(Terminal, { size: 16 }),
|
|
99
|
-
onPress: () => go('publish'),
|
|
100
|
-
},
|
|
101
58
|
],
|
|
102
59
|
},
|
|
103
60
|
];
|
|
@@ -113,7 +70,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
113
70
|
inputPorts: [],
|
|
114
71
|
outputPorts: ['MESSAGE'],
|
|
115
72
|
defaultInputs: { input_value: 'Create a 24mm anamorphic cyberpunk rooftop trailer shot with synthwave score', files: '' },
|
|
116
|
-
pythonSource: `from flow.custom import Component\nfrom flow.io import MessageTextInput, Output\n\nclass ChatInputComponent(Component):\n display_name = "Chat Input"\n inputs = [MessageTextInput(name="input_value", display_name="Text")]\n outputs = [Output(display_name="Message", name="message", method="message_response")]\n\n def message_response(self) -> str:\n return self.input_value`,
|
|
117
73
|
},
|
|
118
74
|
{
|
|
119
75
|
type: 'ZenAgentNode',
|
|
@@ -124,7 +80,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
124
80
|
inputPorts: ['input_message', 'tools', 'context'],
|
|
125
81
|
outputPorts: ['PROMPT', 'JSON_SPEC'],
|
|
126
82
|
defaultInputs: { model: 'zen5', system_prompt: 'Expand user brief into a precision ComfyUI camera rig + lighting prompt.', temperature: 0.3 },
|
|
127
|
-
pythonSource: `from flow.custom import Component\nfrom flow.io import MessageTextInput, DropdownInput, Output\n\nclass ZenAgentComponent(Component):\n display_name = "Hanzo Zen Agent"\n def run_agent(self) -> str:\n return self.llm.invoke(self.input_message)`,
|
|
128
83
|
},
|
|
129
84
|
{
|
|
130
85
|
type: 'PromptTemplateNode',
|
|
@@ -135,7 +90,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
135
90
|
inputPorts: ['variables'],
|
|
136
91
|
outputPorts: ['PROMPT'],
|
|
137
92
|
defaultInputs: { template: '{subject}, shot on {lens}, {lighting}, {camera_rig}, photorealistic 8k' },
|
|
138
|
-
pythonSource: `from flow.custom import Component\n\nclass PromptTemplateComponent(Component):\n display_name = "Prompt Template"\n def build_prompt(self) -> str:\n return self.template.format(**self.variables)`,
|
|
139
93
|
},
|
|
140
94
|
{
|
|
141
95
|
type: 'MCPToolNode',
|
|
@@ -146,7 +100,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
146
100
|
inputPorts: ['query'],
|
|
147
101
|
outputPorts: ['TOOL', 'CONTEXT'],
|
|
148
102
|
defaultInputs: { server: 'hanzo-mcp', tool_name: 'search_brand_assets', transport: 'sse' },
|
|
149
|
-
pythonSource: `from flow.custom import Component\n\nclass MCPToolComponent(Component):\n display_name = "MCP Tool Client"\n async def call_tool(self):\n return await self.mcp_client.call(self.tool_name, self.query)`,
|
|
150
103
|
},
|
|
151
104
|
{
|
|
152
105
|
type: 'VectorStoreRAG',
|
|
@@ -157,7 +110,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
157
110
|
inputPorts: ['search_query'],
|
|
158
111
|
outputPorts: ['CONTEXT'],
|
|
159
112
|
defaultInputs: { collection: 'brand_lookbook_v3', top_k: 4, embedding_model: 'zen-embed-1' },
|
|
160
|
-
pythonSource: `from flow.custom import Component\n\nclass VectorStoreRAGComponent(Component):\n display_name = "Hanzo Vector RAG"\n def retrieve(self) -> list:\n return self.vector_db.similarity_search(self.search_query, k=self.top_k)`,
|
|
161
113
|
},
|
|
162
114
|
{
|
|
163
115
|
type: 'PythonSandboxNode',
|
|
@@ -168,7 +120,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
168
120
|
inputPorts: ['data'],
|
|
169
121
|
outputPorts: ['DATA', 'IMAGE'],
|
|
170
122
|
defaultInputs: { script_name: 'custom_transform.py', timeout_sec: 30 },
|
|
171
|
-
pythonSource: `from studio_compat import io\nimport torch\n\nclass CustomStudioNode(io.ComfyNode):\n @classmethod\n def INPUT_TYPES(cls):\n return {"required": {"images": ("IMAGE",), "gain": ("FLOAT", {"default": 1.15})}}\n RETURN_TYPES = ("IMAGE",)\n FUNCTION = "execute"\n def execute(self, images, gain):\n return (torch.clamp(images * gain, 0.0, 1.0),)`,
|
|
172
123
|
},
|
|
173
124
|
// ── COMFYUI / STUDIO_COMPAT NATIVE MEDIA EXTENSIONS ─────────────────────────
|
|
174
125
|
{
|
|
@@ -180,7 +131,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
180
131
|
inputPorts: [],
|
|
181
132
|
outputPorts: ['MODEL'],
|
|
182
133
|
defaultInputs: { unet_name: 'koma2_ti2v_5B_fp16.safetensors', weight_dtype: 'fp16' },
|
|
183
|
-
pythonSource: `class UNETLoader:\n @classmethod\n def INPUT_TYPES(s):\n return {"required": {"unet_name": (folder_paths.get_filename_list("diffusion_models"),), "weight_dtype": (["default", "fp16", "bf16", "fp8_e4m3fn"],)}}\n RETURN_TYPES = ("MODEL",)\n FUNCTION = "load_unet"`,
|
|
184
134
|
},
|
|
185
135
|
{
|
|
186
136
|
type: 'CLIPLoader',
|
|
@@ -191,7 +141,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
191
141
|
inputPorts: [],
|
|
192
142
|
outputPorts: ['CLIP'],
|
|
193
143
|
defaultInputs: { clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan' },
|
|
194
|
-
pythonSource: `class CLIPLoader:\n RETURN_TYPES = ("CLIP",)\n FUNCTION = "load_clip"`,
|
|
195
144
|
},
|
|
196
145
|
{
|
|
197
146
|
type: 'CheckpointLoaderSimple',
|
|
@@ -202,7 +151,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
202
151
|
inputPorts: [],
|
|
203
152
|
outputPorts: ['MODEL', 'CLIP', 'VAE'],
|
|
204
153
|
defaultInputs: { ckpt_name: 'z_image_turbo_bf16.safetensors' },
|
|
205
|
-
pythonSource: `class CheckpointLoaderSimple:\n RETURN_TYPES = ("MODEL", "CLIP", "VAE")\n FUNCTION = "load_checkpoint"`,
|
|
206
154
|
},
|
|
207
155
|
{
|
|
208
156
|
type: 'UnetLoaderGGUF',
|
|
@@ -213,7 +161,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
213
161
|
inputPorts: [],
|
|
214
162
|
outputPorts: ['MODEL'],
|
|
215
163
|
defaultInputs: { unet_name: 'flux1-dev-Q8_0.gguf' },
|
|
216
|
-
pythonSource: `class UnetLoaderGGUF:\n RETURN_TYPES = ("MODEL",)\n FUNCTION = "load_unet"`,
|
|
217
164
|
},
|
|
218
165
|
{
|
|
219
166
|
type: 'ImageOnlyCheckpointLoader',
|
|
@@ -224,7 +171,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
224
171
|
inputPorts: [],
|
|
225
172
|
outputPorts: ['MODEL', 'CLIP_VISION', 'VAE'],
|
|
226
173
|
defaultInputs: { ckpt_name: 'mori_3d_v2.1.safetensors' },
|
|
227
|
-
pythonSource: `class ImageOnlyCheckpointLoader:\n RETURN_TYPES = ("MODEL", "CLIP_VISION", "VAE")\n FUNCTION = "load_checkpoint"`,
|
|
228
174
|
},
|
|
229
175
|
{
|
|
230
176
|
type: 'LoadImageMask',
|
|
@@ -235,7 +181,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
235
181
|
inputPorts: [],
|
|
236
182
|
outputPorts: ['IMAGE', 'MASK'],
|
|
237
183
|
defaultInputs: { image: 'hero_lookbook.png', channel: 'alpha' },
|
|
238
|
-
pythonSource: `class LoadImageMask:\n RETURN_TYPES = ("IMAGE", "MASK")\n FUNCTION = "load_image"`,
|
|
239
184
|
},
|
|
240
185
|
{
|
|
241
186
|
type: 'CLIPTextEncode',
|
|
@@ -246,7 +191,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
246
191
|
inputPorts: ['clip', 'text_from_agent'],
|
|
247
192
|
outputPorts: ['CONDITIONING'],
|
|
248
193
|
defaultInputs: { text: 'Anamorphic 24mm crane rise over rain-slicked Neo-Kyoto rooftop, volumetric neon backlight' },
|
|
249
|
-
pythonSource: `class CLIPTextEncode:\n RETURN_TYPES = ("CONDITIONING",)\n FUNCTION = "encode"`,
|
|
250
194
|
},
|
|
251
195
|
{
|
|
252
196
|
type: 'KomaImageToVideo',
|
|
@@ -257,7 +201,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
257
201
|
inputPorts: ['positive'],
|
|
258
202
|
outputPorts: ['CONDITIONING', 'LATENT'],
|
|
259
203
|
defaultInputs: { width: 1280, height: 544, length: 81, fps: 24 },
|
|
260
|
-
pythonSource: `class KomaImageToVideo:\n RETURN_TYPES = ("CONDITIONING", "LATENT")\n FUNCTION = "encode"`,
|
|
261
204
|
},
|
|
262
205
|
{
|
|
263
206
|
type: 'LTXVConditioning',
|
|
@@ -268,7 +211,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
268
211
|
inputPorts: ['positive'],
|
|
269
212
|
outputPorts: ['CONDITIONING', 'LATENT'],
|
|
270
213
|
defaultInputs: { frame_rate: 25, width: 1280, height: 720, frames: 97 },
|
|
271
|
-
pythonSource: `class LTXVConditioning:\n RETURN_TYPES = ("CONDITIONING", "CONDITIONING")\n FUNCTION = "append"`,
|
|
272
214
|
},
|
|
273
215
|
{
|
|
274
216
|
type: 'TextEncodeIroImageEdit',
|
|
@@ -279,7 +221,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
279
221
|
inputPorts: ['clip', 'image'],
|
|
280
222
|
outputPorts: ['CONDITIONING'],
|
|
281
223
|
defaultInputs: { instruction: 'Swap jacket to brushed obsidian leather, preserve face and rim lighting' },
|
|
282
|
-
pythonSource: `class TextEncodeIroImageEdit:\n RETURN_TYPES = ("CONDITIONING",)\n FUNCTION = "encode"`,
|
|
283
224
|
},
|
|
284
225
|
{
|
|
285
226
|
type: 'TextEncodeAceStepAudio',
|
|
@@ -290,7 +231,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
290
231
|
inputPorts: ['clip'],
|
|
291
232
|
outputPorts: ['CONDITIONING'],
|
|
292
233
|
defaultInputs: { tags: 'analog synthwave, driving bassline, 122 bpm', lyrics: '[Verse] Neon reflections\n[Chorus] Signals rising', lyric_strength: 1.0 },
|
|
293
|
-
pythonSource: `class TextEncodeAceStepAudio:\n RETURN_TYPES = ("CONDITIONING",)\n FUNCTION = "encode"`,
|
|
294
234
|
},
|
|
295
235
|
{
|
|
296
236
|
type: 'ControlNetApplyAdvanced',
|
|
@@ -301,7 +241,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
301
241
|
inputPorts: ['positive', 'image'],
|
|
302
242
|
outputPorts: ['CONDITIONING'],
|
|
303
243
|
defaultInputs: { strength: 0.85, start_percent: 0.0, end_percent: 1.0 },
|
|
304
|
-
pythonSource: `class ControlNetApplyAdvanced:\n RETURN_TYPES = ("CONDITIONING", "CONDITIONING")\n FUNCTION = "apply_controlnet"`,
|
|
305
244
|
},
|
|
306
245
|
{
|
|
307
246
|
type: 'IPAdapterAdvanced',
|
|
@@ -312,7 +251,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
312
251
|
inputPorts: ['model', 'image'],
|
|
313
252
|
outputPorts: ['MODEL'],
|
|
314
253
|
defaultInputs: { weight: 0.8, weight_type: 'linear' },
|
|
315
|
-
pythonSource: `class IPAdapterAdvanced:\n RETURN_TYPES = ("MODEL",)\n FUNCTION = "apply_ipadapter"`,
|
|
316
254
|
},
|
|
317
255
|
{
|
|
318
256
|
type: 'KSampler',
|
|
@@ -323,7 +261,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
323
261
|
inputPorts: ['model', 'positive', 'latent_image'],
|
|
324
262
|
outputPorts: ['LATENT'],
|
|
325
263
|
defaultInputs: { seed: 408921, steps: 28, cfg: 5.0, sampler_name: 'uni_pc', scheduler: 'simple', denoise: 1.0 },
|
|
326
|
-
pythonSource: `class KSampler:\n RETURN_TYPES = ("LATENT",)\n FUNCTION = "sample"`,
|
|
327
264
|
},
|
|
328
265
|
{
|
|
329
266
|
type: 'ModelSamplingAuraFlow',
|
|
@@ -334,7 +271,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
334
271
|
inputPorts: ['model', 'positive'],
|
|
335
272
|
outputPorts: ['LATENT'],
|
|
336
273
|
defaultInputs: { shift: 3.0, seed: 771204, steps: 8, cfg: 1.0 },
|
|
337
|
-
pythonSource: `class ModelSamplingAuraFlow:\n RETURN_TYPES = ("MODEL",)\n FUNCTION = "patch_aura"`,
|
|
338
274
|
},
|
|
339
275
|
{
|
|
340
276
|
type: 'DemucsStemSeparation',
|
|
@@ -345,7 +281,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
345
281
|
inputPorts: ['audio'],
|
|
346
282
|
outputPorts: ['VOCALS', 'DRUMS', 'BASS', 'OTHER'],
|
|
347
283
|
defaultInputs: { model: 'htdemucs_ft', shifts: 2, overlap: 0.25 },
|
|
348
|
-
pythonSource: `class DemucsStemSeparation:\n RETURN_TYPES = ("AUDIO", "AUDIO", "AUDIO", "AUDIO")\n FUNCTION = "separate"`,
|
|
349
284
|
},
|
|
350
285
|
{
|
|
351
286
|
type: 'MMAudioVideoToAudio',
|
|
@@ -356,7 +291,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
356
291
|
inputPorts: ['images'],
|
|
357
292
|
outputPorts: ['AUDIO'],
|
|
358
293
|
defaultInputs: { prompt: 'Rain hitting wet pavement, distant turbine hum, footsteps', duration: 8.0, cfg: 4.5 },
|
|
359
|
-
pythonSource: `class MMAudioVideoToAudio:\n RETURN_TYPES = ("AUDIO",)\n FUNCTION = "generate_foley"`,
|
|
360
294
|
},
|
|
361
295
|
{
|
|
362
296
|
type: 'KokoroTTS',
|
|
@@ -367,7 +301,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
367
301
|
inputPorts: ['text'],
|
|
368
302
|
outputPorts: ['AUDIO'],
|
|
369
303
|
defaultInputs: { text: 'Every node in the cluster is locked in phase.', voice: 'af_bella', speed: 1.0 },
|
|
370
|
-
pythonSource: `class KokoroTTS:\n RETURN_TYPES = ("AUDIO",)\n FUNCTION = "synthesize"`,
|
|
371
304
|
},
|
|
372
305
|
{
|
|
373
306
|
type: 'VAEDecode',
|
|
@@ -378,7 +311,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
378
311
|
inputPorts: ['samples', 'vae'],
|
|
379
312
|
outputPorts: ['IMAGE'],
|
|
380
313
|
defaultInputs: {},
|
|
381
|
-
pythonSource: `class VAEDecode:\n RETURN_TYPES = ("IMAGE",)\n FUNCTION = "decode"`,
|
|
382
314
|
},
|
|
383
315
|
{
|
|
384
316
|
type: 'VoxelToMesh',
|
|
@@ -389,7 +321,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
389
321
|
inputPorts: ['samples'],
|
|
390
322
|
outputPorts: ['MESH'],
|
|
391
323
|
defaultInputs: { algorithm: 'surface_net', threshold: 0.0, octree_resolution: 384 },
|
|
392
|
-
pythonSource: `class VoxelToMesh:\n RETURN_TYPES = ("MESH",)\n FUNCTION = "convert"`,
|
|
393
324
|
},
|
|
394
325
|
{
|
|
395
326
|
type: 'UltimateSDUpscale',
|
|
@@ -400,7 +331,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
400
331
|
inputPorts: ['image', 'model'],
|
|
401
332
|
outputPorts: ['IMAGE'],
|
|
402
333
|
defaultInputs: { upscale_by: 2.0, steps: 16, denoise: 0.25 },
|
|
403
|
-
pythonSource: `class UltimateSDUpscale:\n RETURN_TYPES = ("IMAGE",)\n FUNCTION = "upscale"`,
|
|
404
334
|
},
|
|
405
335
|
{
|
|
406
336
|
type: 'SaveWEBM',
|
|
@@ -411,7 +341,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
411
341
|
inputPorts: ['images'],
|
|
412
342
|
outputPorts: [],
|
|
413
343
|
defaultInputs: { filename_prefix: 'video/koma2_cinema', codec: 'vp9', fps: 24, crf: 18 },
|
|
414
|
-
pythonSource: `class SaveWEBM:\n RETURN_TYPES = ()\n OUTPUT_NODE = True\n FUNCTION = "save_video"`,
|
|
415
344
|
},
|
|
416
345
|
{
|
|
417
346
|
type: 'ConcatVideo',
|
|
@@ -422,7 +351,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
422
351
|
inputPorts: ['videos'],
|
|
423
352
|
outputPorts: ['VIDEO'],
|
|
424
353
|
defaultInputs: { paths: 'shot_01.mp4\nshot_02.mp4\nshot_03.mp4', filename_prefix: 'film/master_cut' },
|
|
425
|
-
pythonSource: `class ConcatVideo:\n RETURN_TYPES = ("VIDEO",)\n OUTPUT_NODE = True\n FUNCTION = "concat_videos"`,
|
|
426
354
|
},
|
|
427
355
|
{
|
|
428
356
|
type: 'SaveImage',
|
|
@@ -433,7 +361,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
433
361
|
inputPorts: ['images'],
|
|
434
362
|
outputPorts: [],
|
|
435
363
|
defaultInputs: { filename_prefix: 'image/studio_render' },
|
|
436
|
-
pythonSource: `class SaveImage:\n RETURN_TYPES = ()\n OUTPUT_NODE = True\n FUNCTION = "save_images"`,
|
|
437
364
|
},
|
|
438
365
|
{
|
|
439
366
|
type: 'SaveGLB',
|
|
@@ -444,7 +371,6 @@ export const FLOW_MODULE_CATALOG = [
|
|
|
444
371
|
inputPorts: ['mesh'],
|
|
445
372
|
outputPorts: [],
|
|
446
373
|
defaultInputs: { filename_prefix: 'mesh/mori3d_asset' },
|
|
447
|
-
pythonSource: `class SaveGLB:\n RETURN_TYPES = ()\n OUTPUT_NODE = True\n FUNCTION = "save_glb"`,
|
|
448
374
|
},
|
|
449
375
|
];
|
|
450
376
|
export const FLOW_BLUEPRINTS = [
|
|
@@ -523,18 +449,21 @@ function formatClock(d = new Date()) {
|
|
|
523
449
|
}
|
|
524
450
|
export function FlowStudio({ host }) {
|
|
525
451
|
const wire = useWire(host);
|
|
526
|
-
const
|
|
452
|
+
const { spend, dialog } = useSpend(host);
|
|
453
|
+
const flowsOf = (org) => keptFlows(org) ?? FLOW_BLUEPRINTS.map((b) => ({ ...b, nodes: cloneNodes(b.nodes) }));
|
|
454
|
+
const [blueprints, setBlueprints] = useState(() => flowsOf(host.org));
|
|
455
|
+
// Another organization's flows are its own: they are read before anything is kept, so one org's never lands under another's.
|
|
456
|
+
const [shownOrg, setShownOrg] = useState(host.org);
|
|
457
|
+
if (shownOrg !== host.org) {
|
|
458
|
+
setShownOrg(host.org);
|
|
459
|
+
setBlueprints(flowsOf(host.org));
|
|
460
|
+
}
|
|
461
|
+
// Every edit is kept in this browser, so it is there when Flow opens again; the status line says where.
|
|
462
|
+
const [kept, setKept] = useState(true);
|
|
527
463
|
useEffect(() => {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
setSection(next);
|
|
532
|
-
host.go?.(next === 'canvas' ? '' : next);
|
|
533
|
-
};
|
|
534
|
-
const [blueprints, setBlueprints] = useState(() => FLOW_BLUEPRINTS.map((b) => ({
|
|
535
|
-
...b,
|
|
536
|
-
nodes: cloneNodes(b.nodes),
|
|
537
|
-
})));
|
|
464
|
+
if (shownOrg === host.org)
|
|
465
|
+
setKept(keepFlows(host.org, blueprints));
|
|
466
|
+
}, [blueprints, host.org, shownOrg]);
|
|
538
467
|
const [activeBlueprintId, setActiveBlueprintId] = useState(FLOW_BLUEPRINTS[0].id);
|
|
539
468
|
const activeBlueprint = blueprints.find((b) => b.id === activeBlueprintId) ?? blueprints[0];
|
|
540
469
|
const [selectedNodeId, setSelectedNodeId] = useState(activeBlueprint.nodes[0]?.id ?? '1');
|
|
@@ -561,7 +490,7 @@ export function FlowStudio({ host }) {
|
|
|
561
490
|
const [runningFlow, setRunningFlow] = useState(false);
|
|
562
491
|
const [nodeRunStatus, setNodeRunStatus] = useState({});
|
|
563
492
|
const [copilotInput, setCopilotInput] = useState('');
|
|
564
|
-
const [statusMessage, setStatusMessage] = useState('
|
|
493
|
+
const [statusMessage, setStatusMessage] = useState('');
|
|
565
494
|
const [playgroundOutput, setPlaygroundOutput] = useState([
|
|
566
495
|
`[${formatClock()}] Ready · ${FLOW_BLUEPRINTS[0].nodes.length} nodes loaded (${FLOW_BLUEPRINTS[0].engine})`,
|
|
567
496
|
]);
|
|
@@ -756,7 +685,6 @@ export function FlowStudio({ host }) {
|
|
|
756
685
|
inputPorts: ['input'],
|
|
757
686
|
outputPorts: Array.isArray(spec.output) ? spec.output.map(String) : ['OUTPUT'],
|
|
758
687
|
defaultInputs: {},
|
|
759
|
-
pythonSource: `class ${type}(io.ComfyNode):\n # Loaded dynamically from studio-v1 /v1/object_info\n pass`,
|
|
760
688
|
});
|
|
761
689
|
}
|
|
762
690
|
if (extra.length > 0)
|
|
@@ -767,19 +695,9 @@ export function FlowStudio({ host }) {
|
|
|
767
695
|
alive = false;
|
|
768
696
|
};
|
|
769
697
|
}, [wire]);
|
|
770
|
-
const selectedSpec = moduleCatalog.find((m) => m.type === selectedNode.type);
|
|
771
|
-
const [pythonDraft, setPythonDraft] = useState(() => selectedNode.pythonCode || selectedSpec?.pythonSource || '');
|
|
772
|
-
useEffect(() => {
|
|
773
|
-
const spec = moduleCatalog.find((m) => m.type === selectedNode.type);
|
|
774
|
-
setPythonDraft(selectedNode.pythonCode || spec?.pythonSource || '');
|
|
775
|
-
}, [selectedNode, moduleCatalog]);
|
|
776
698
|
const updateNodeInput = (key, val) => {
|
|
777
699
|
commitGraph((nodes) => nodes.map((n) => (n.id === selectedNode.id ? { ...n, inputs: { ...n.inputs, [key]: val } } : n)), { coalesceKey: `${selectedNode.id}:${key}` });
|
|
778
700
|
};
|
|
779
|
-
const saveNodePythonCode = () => {
|
|
780
|
-
commitGraph((nodes) => nodes.map((n) => (n.id === selectedNode.id ? { ...n, pythonCode: pythonDraft } : n)));
|
|
781
|
-
setStatusMessage(`Saved live Python component class for #${selectedNode.id} ${selectedNode.type}`);
|
|
782
|
-
};
|
|
783
701
|
const addModuleToCanvas = (spec) => {
|
|
784
702
|
const nextId = String(Math.max(0, ...activeBlueprint.nodes.map((n) => Number(n.id) || 0)) + 1);
|
|
785
703
|
const col = spec.category === 'agent'
|
|
@@ -803,7 +721,6 @@ export function FlowStudio({ host }) {
|
|
|
803
721
|
y: 30 + inCol * 155,
|
|
804
722
|
inputs: { ...spec.defaultInputs },
|
|
805
723
|
wiresFrom: selectedNode ? [selectedNode.id] : [],
|
|
806
|
-
pythonCode: spec.pythonSource,
|
|
807
724
|
};
|
|
808
725
|
commitGraph((nodes) => [...nodes, created]);
|
|
809
726
|
setSelectedNodeId(nextId);
|
|
@@ -836,8 +753,6 @@ export function FlowStudio({ host }) {
|
|
|
836
753
|
}, [activeBlueprint.nodes, commitGraph]);
|
|
837
754
|
// Keyboard shortcuts: Cmd/Ctrl+Z undo, Cmd/Ctrl+Shift+Z or Ctrl+Y redo, Delete/Backspace delete node
|
|
838
755
|
useEffect(() => {
|
|
839
|
-
if (section !== 'canvas' && section !== 'comfy' && section !== 'agents')
|
|
840
|
-
return;
|
|
841
756
|
const onKeyDown = (e) => {
|
|
842
757
|
const target = e.target;
|
|
843
758
|
const tag = target?.tagName;
|
|
@@ -862,7 +777,7 @@ export function FlowStudio({ host }) {
|
|
|
862
777
|
};
|
|
863
778
|
window.addEventListener('keydown', onKeyDown);
|
|
864
779
|
return () => window.removeEventListener('keydown', onKeyDown);
|
|
865
|
-
}, [
|
|
780
|
+
}, [undo, redo, deleteNode, selectedNode, activeBlueprint.nodes.length]);
|
|
866
781
|
const autoLayout = () => {
|
|
867
782
|
const order = {
|
|
868
783
|
agent: 0,
|
|
@@ -912,9 +827,16 @@ export function FlowStudio({ host }) {
|
|
|
912
827
|
setNodeRunStatus({});
|
|
913
828
|
return () => f.stop();
|
|
914
829
|
}, [activeBlueprint.id]);
|
|
915
|
-
|
|
830
|
+
// One run per press, asked first: Run queues paid GPU work that goes on when the page closes. The lock is
|
|
831
|
+
// synchronous and held until the run ends, so a second press, while it asks or while the job is queued, starts nothing.
|
|
832
|
+
const runLock = useRef(false);
|
|
833
|
+
const runFlowPlayground = () => alone(runLock, async () => {
|
|
916
834
|
if (runningFlow)
|
|
917
835
|
return;
|
|
836
|
+
if (await spend('flow-run', { what: `This queues ${activeBlueprint.nodes.length} nodes of "${activeBlueprint.name}" on the GPU, where it keeps running if you leave this page.` }))
|
|
837
|
+
await runQueued();
|
|
838
|
+
});
|
|
839
|
+
const runQueued = async () => {
|
|
918
840
|
const mine = followed.current.start();
|
|
919
841
|
setRunningFlow(true);
|
|
920
842
|
const nodes = activeBlueprint.nodes;
|
|
@@ -926,15 +848,17 @@ export function FlowStudio({ host }) {
|
|
|
926
848
|
setStatusMessage(status);
|
|
927
849
|
};
|
|
928
850
|
say(`Sending ${nodes.length} nodes of ${activeBlueprint.name} to /v1/prompt`, `Sending "${activeBlueprint.name}" to /v1/prompt…`);
|
|
851
|
+
// A job the engine still holds (queued or running when following it stopped) is still this flow's one job.
|
|
852
|
+
let held = false;
|
|
929
853
|
try {
|
|
930
854
|
const end = await run(wire, compiledComfyPrompt, (state, note) => {
|
|
931
855
|
if (!mine.current())
|
|
932
856
|
return;
|
|
933
|
-
setRunningFlow(false);
|
|
934
857
|
mark(state);
|
|
935
858
|
say(`${state[0].toUpperCase()}${state.slice(1)}${note ? ` · ${note}` : ''}`, `"${activeBlueprint.name}" is ${state}${note ? `: ${note}` : ''}`);
|
|
936
859
|
}, { signal: mine.signal });
|
|
937
|
-
|
|
860
|
+
held = end === 'queued' || end === 'running';
|
|
861
|
+
if (mine.current() && held)
|
|
938
862
|
say(`Still ${end}; no result yet`, `"${activeBlueprint.name}" is still ${end}; no result yet`);
|
|
939
863
|
}
|
|
940
864
|
catch (e) {
|
|
@@ -945,16 +869,22 @@ export function FlowStudio({ host }) {
|
|
|
945
869
|
say(`Not run · ${why}`, `"${activeBlueprint.name}" did not run: ${why}`);
|
|
946
870
|
}
|
|
947
871
|
finally {
|
|
948
|
-
|
|
872
|
+
// Run stays off while the engine holds the job, so a press cannot queue a second one behind it.
|
|
873
|
+
if (mine.current() && !held)
|
|
949
874
|
setRunningFlow(false);
|
|
950
875
|
}
|
|
951
876
|
};
|
|
952
877
|
// Copilot asks the model to edit the graph and applies exactly the edit it answers with.
|
|
953
878
|
const [copilotBusy, setCopilotBusy] = useState(false);
|
|
954
|
-
const
|
|
879
|
+
const mutateLock = useRef(false);
|
|
880
|
+
const runCopilot = () => alone(mutateLock, mutate);
|
|
881
|
+
const mutate = async () => {
|
|
955
882
|
const text = copilotInput.trim();
|
|
956
883
|
if (!text || copilotBusy)
|
|
957
884
|
return;
|
|
885
|
+
// A model request: asked first, once per press.
|
|
886
|
+
if (!(await spend('flow-mutate')))
|
|
887
|
+
return;
|
|
958
888
|
setCopilotBusy(true);
|
|
959
889
|
setStatusMessage(`Asking Flow Copilot: "${text}"…`);
|
|
960
890
|
try {
|
|
@@ -1067,39 +997,21 @@ export function FlowStudio({ host }) {
|
|
|
1067
997
|
};
|
|
1068
998
|
input.click();
|
|
1069
999
|
};
|
|
1070
|
-
const TABS = [
|
|
1071
|
-
{ id: 'canvas', label: 'Canvas' },
|
|
1072
|
-
{ id: 'comfy', label: 'ComfyUI' },
|
|
1073
|
-
{ id: 'agents', label: 'Agents & MCP' },
|
|
1074
|
-
{ id: 'code', label: 'Python' },
|
|
1075
|
-
{ id: 'publish', label: 'Publish' },
|
|
1076
|
-
];
|
|
1077
1000
|
const langflowCount = activeBlueprint.nodes.filter((n) => n.family === 'langflow').length;
|
|
1078
1001
|
const comfyCount = activeBlueprint.nodes.filter((n) => n.family === 'comfy').length;
|
|
1079
1002
|
const filteredCatalog = useMemo(() => moduleCatalog
|
|
1080
|
-
.filter((m) =>
|
|
1081
|
-
if (section === 'comfy')
|
|
1082
|
-
return m.family === 'comfy';
|
|
1083
|
-
if (section === 'agents')
|
|
1084
|
-
return m.family === 'langflow';
|
|
1085
|
-
return familyFilter === 'all' ? true : m.family === familyFilter;
|
|
1086
|
-
})
|
|
1003
|
+
.filter((m) => (familyFilter === 'all' ? true : m.family === familyFilter))
|
|
1087
1004
|
.filter((m) => {
|
|
1088
1005
|
const q = searchQuery.trim().toLowerCase();
|
|
1089
1006
|
if (!q)
|
|
1090
1007
|
return true;
|
|
1091
1008
|
return m.type.toLowerCase().includes(q) || m.title.toLowerCase().includes(q) || m.pack.toLowerCase().includes(q);
|
|
1092
|
-
}), [moduleCatalog,
|
|
1009
|
+
}), [moduleCatalog, familyFilter, searchQuery]);
|
|
1093
1010
|
const visibleCatalog = catalogExpanded || searchQuery.trim().length > 0 ? filteredCatalog : filteredCatalog.slice(0, 5);
|
|
1094
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, minW: 0, width: "100%", bg: "var(--background)", p: "$3", $md: { p: '$4' }, gap: "$3", overflowY: "auto", overflowX: "hidden", "data-slot": "flow-studio", children: [
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
{ key: 'publish', label: 'Publish API / MCP', description: 'Inspect REST & MCP payload', icon: _jsx(Terminal, { size: 13, color: "$soft" }), onSelect: () => switchSection('publish') },
|
|
1099
|
-
] }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": "Back to Hanzo Studio", onClick: () => host.open('/studio'), items: "center", gap: "$1.5", px: "$3", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 32, height: 32 }, rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, shrink: 0, children: [_jsx(ArrowLeft, { size: 13, color: "$ink" }), _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$ink", children: "Back to Studio" })] })] })] }), _jsx(XStack, { role: "tablist", "aria-label": "Flow sections", gap: "$1.5", pt: "$1", pb: "$0.5", overflowX: "auto", flexWrap: "nowrap", width: "100%", display: "flex", $md: { display: 'none' }, style: { scrollbarWidth: 'none' }, children: TABS.map((t) => {
|
|
1100
|
-
const on = section === t.id;
|
|
1101
|
-
return (_jsx(XStack, { render: _jsx("button", { type: "button" }), role: "tab", "aria-selected": on, onClick: () => switchSection(t.id), px: "$3", minH: 44, "$max-sm": { minH: 44 }, items: "center", rounded: 999, borderWidth: 1, borderColor: on ? '$ink' : 'var(--border-strong)', bg: on ? 'var(--surface-card-emphasis)' : 'transparent', cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, shrink: 0, children: _jsx(SizableText, { size: "$1", fontWeight: on ? '600' : '500', color: on ? '$ink' : '$soft', children: t.label }) }, t.id));
|
|
1102
|
-
}) })] }), section === 'canvas' || section === 'comfy' || section === 'agents' ? (_jsxs(YStack, { gap: "$3", flex: 1, minW: 0, width: "100%", $xl: { flexDirection: 'row', items: 'flex-start' }, children: [_jsxs(YStack, { width: "100%", minW: 0, $xl: { width: 276, shrink: 0 }, $xxl: { width: 288 }, gap: "$3", p: "$3", rounded: "$4", borderWidth: 1, borderColor: "var(--border)", bg: "var(--surface-card)", children: [_jsxs(YStack, { gap: "$2", minW: 0, children: [_jsx(SizableText, { render: "h2", size: "$3", fontWeight: "600", color: "$ink", children: "1. Flow templates" }), _jsx(YStack, { gap: "$1.5", role: "list", "aria-label": "Flow templates", minW: 0, children: blueprints.map((b) => {
|
|
1011
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, minW: 0, width: "100%", bg: "var(--background)", p: "$3", $md: { p: '$4' }, gap: "$3", overflowY: "auto", overflowX: "hidden", "data-slot": "flow-studio", children: [_jsx(YStack, { gap: "$2.5", p: "$3", rounded: "$4", borderWidth: 1, borderColor: "var(--border)", bg: "var(--surface-card)", minW: 0, children: _jsxs(XStack, { items: "center", justify: "space-between", flexWrap: "wrap", gap: "$2.5", minW: 0, children: [_jsxs(YStack, { gap: 2, flex: 1, minW: 200, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Workflow, { size: 16, color: "$ink" }), _jsx(SizableText, { render: "h1", size: "$4", fontWeight: "600", color: "$ink", letterSpacing: -0.25, numberOfLines: 1, children: "Hanzo Flow \u2014 Visual workflow builder" })] }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: kept ? 'Your flows are kept in this browser.' : 'This browser is not keeping your flows: an edit goes when you leave this page.' }), statusMessage ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: statusMessage })) : null] }), _jsxs(XStack, { items: "center", gap: "$1.5", flexWrap: "wrap", shrink: 0, maxW: "100%", children: [_jsx(DropdownMenu, { minWidth: 210, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": "Import or export flow JSON", items: "center", gap: "$1.5", px: "$3", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 32, height: 32 }, rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, shrink: 0, children: [_jsx(Download, { size: 13, color: "$ink" }), _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$ink", children: "JSON" }), _jsx(ChevronDown, { size: 12, color: "$soft" })] }), items: [
|
|
1012
|
+
{ key: 'import', label: 'Import JSON', description: 'Load Langflow or ComfyUI graph', icon: _jsx(Upload, { size: 13, color: "$soft" }), onSelect: importJson },
|
|
1013
|
+
{ key: 'export', label: 'Export JSON', description: 'Download compiled /v1/prompt graph', icon: _jsx(Download, { size: 13, color: "$soft" }), onSelect: exportJson },
|
|
1014
|
+
] }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": "Back to Design", onClick: () => host.open('/design'), items: "center", gap: "$1.5", px: "$3", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 32, height: 32 }, rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, shrink: 0, children: [_jsx(ArrowLeft, { size: 13, color: "$ink" }), _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$ink", children: "Back to Design" })] })] })] }) }), _jsxs(YStack, { gap: "$3", flex: 1, minW: 0, width: "100%", $xl: { flexDirection: 'row', items: 'flex-start' }, children: [_jsxs(YStack, { width: "100%", minW: 0, $xl: { width: 276, shrink: 0 }, $xxl: { width: 288 }, gap: "$3", p: "$3", rounded: "$4", borderWidth: 1, borderColor: "var(--border)", bg: "var(--surface-card)", children: [_jsxs(YStack, { gap: "$2", minW: 0, children: [_jsx(SizableText, { render: "h2", size: "$3", fontWeight: "600", color: "$ink", children: "1. Flow templates" }), _jsx(YStack, { gap: "$1.5", role: "list", "aria-label": "Flow templates", minW: 0, children: blueprints.map((b) => {
|
|
1103
1015
|
const on = b.id === activeBlueprint.id;
|
|
1104
1016
|
return (_jsx(YStack, { role: "listitem", width: "100%", minW: 0, children: _jsxs(YStack, { render: _jsx("button", { type: "button" }), onClick: () => {
|
|
1105
1017
|
setActiveBlueprintId(b.id);
|
|
@@ -1112,14 +1024,14 @@ export function FlowStudio({ host }) {
|
|
|
1112
1024
|
}) })] }), _jsxs(YStack, { gap: "$2", pt: "$2.5", borderTopWidth: 1, borderColor: "var(--border)", minW: 0, children: [_jsxs(XStack, { justify: "space-between", items: "center", gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$3", fontWeight: "600", color: "$ink", children: "2. Component library" }), _jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", children: `${filteredCatalog.length} nodes` })] }), _jsx(FlowInput, { "aria-label": "Search Langflow and ComfyUI components", ...{
|
|
1113
1025
|
placeholder: 'Search ZenAgent, RAG, MCP, Koma…',
|
|
1114
1026
|
value: searchQuery,
|
|
1115
|
-
}, onChange: (e) => setSearchQuery(e.currentTarget.value) }),
|
|
1027
|
+
}, onChange: (e) => setSearchQuery(e.currentTarget.value) }), _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: [
|
|
1116
1028
|
{ id: 'all', label: 'All' },
|
|
1117
1029
|
{ id: 'langflow', label: 'Agents' },
|
|
1118
1030
|
{ id: 'comfy', label: 'ComfyUI' },
|
|
1119
1031
|
].map((f) => {
|
|
1120
1032
|
const on = familyFilter === f.id;
|
|
1121
1033
|
return (_jsx(XStack, { render: _jsx("button", { type: "button" }), "aria-pressed": on, onClick: () => setFamilyFilter(f.id), px: "$2.5", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 28, height: 28 }, items: "center", rounded: 999, borderWidth: 1, borderColor: on ? '$ink' : 'var(--border-strong)', bg: on ? 'var(--surface-card-emphasis)' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, cursor: "pointer", children: _jsx(SizableText, { size: "$1", fontWeight: on ? '600' : '500', color: on ? '$ink' : '$soft', children: f.label }) }, f.id));
|
|
1122
|
-
}) })
|
|
1034
|
+
}) }), _jsxs(YStack, { gap: "$1.5", maxH: 280, overflowY: "auto", pt: "$1", minW: 0, children: [visibleCatalog.map((spec) => (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: () => addModuleToCanvas(spec), width: "100%", minW: 0, minH: 44, "$max-sm": { minH: 44 }, p: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "var(--border)", bg: "var(--background)", justify: "space-between", items: "center", gap: "$2", cursor: "pointer", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: RING, children: [_jsxs(YStack, { gap: 2, flex: 1, minW: 0, items: "flex-start", children: [_jsxs(XStack, { items: "center", gap: "$1.5", maxW: "100%", children: [_jsx(XStack, { width: 7, height: 7, rounded: 99, bg: spec.family === 'langflow' ? '$ink' : 'transparent', borderWidth: spec.family === 'langflow' ? 0 : 1.5, borderColor: "$soft", shrink: 0 }), _jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", text: "left", numberOfLines: 1, children: `+ ${spec.type}` })] }), _jsx(SizableText, { size: "$1", color: "$soft", text: "left", numberOfLines: 1, children: `${spec.title} · ${spec.pack}` })] }), _jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", shrink: 0, children: spec.outputPorts[0] || 'OUT' })] }, spec.type))), !searchQuery.trim() && filteredCatalog.length > 5 ? (_jsx(XStack, { render: _jsx("button", { type: "button" }), "aria-expanded": catalogExpanded, onClick: () => setCatalogExpanded((v) => !v), width: "100%", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, px: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", items: "center", justify: "center", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$soft", children: catalogExpanded ? 'Show fewer nodes' : `Show all ${filteredCatalog.length} nodes` }) })) : null] })] })] }), _jsxs(YStack, { width: "100%", minW: 0, $xl: { flex: 1 }, gap: "$3", p: "$3.5", rounded: "$4", borderWidth: 1, borderColor: "var(--border)", bg: "var(--surface-card)", children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", flexWrap: "wrap", gap: "$2.5", minW: 0, children: [_jsxs(YStack, { gap: 2, flex: 1, minW: 200, children: [_jsx(SizableText, { render: "h2", size: "$3", fontWeight: "600", color: "$ink", children: activeBlueprint.name }), _jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", children: `${activeBlueprint.nodes.length} nodes (${langflowCount} Langflow · ${comfyCount} ComfyUI) · ${activeBlueprint.engine}` })] }), _jsxs(XStack, { gap: "$1.5", items: "center", flexWrap: "wrap", shrink: 0, children: [_jsx(XStack, { render: _jsx("button", { type: "button" }), onClick: autoLayout, px: "$2.5", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 32, height: 32 }, items: "center", rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, shrink: 0, children: _jsx(SizableText, { size: "$1", color: "$ink", children: "Auto-layout" }) }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": "Run flow (/v1/prompt)", disabled: runningFlow, onClick: () => void runFlowPlayground(), px: "$4", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 32, height: 32 }, items: "center", gap: "$1.5", rounded: 999, bg: "$ink", opacity: runningFlow ? 0.65 : 1, cursor: runningFlow ? 'default' : 'pointer', hoverStyle: runningFlow ? undefined : { opacity: 0.9 }, focusVisibleStyle: RING, shrink: 0, children: [_jsx(Play, { size: 12, color: "$background" }), _jsx(SizableText, { size: "$2", color: "$background", fontWeight: "600", children: runningFlow ? 'Running…' : 'Run flow' })] })] })] }), _jsxs(XStack, { gap: "$2", items: "center", flexWrap: "wrap", minW: 0, children: [_jsx(FlowInput, { "aria-label": "Flow Copilot instruction", flex: 1, minW: 180, rounded: 999, px: "$3.5", ...{
|
|
1123
1035
|
placeholder: 'Ask Copilot to add a node or tidy the layout…',
|
|
1124
1036
|
value: copilotInput,
|
|
1125
1037
|
onKeyDown: (e) => {
|
|
@@ -1209,5 +1121,5 @@ export function FlowStudio({ host }) {
|
|
|
1209
1121
|
const raw = e.currentTarget.value;
|
|
1210
1122
|
updateNodeInput(key, typeof val === 'number' ? Number(raw) : raw);
|
|
1211
1123
|
} }))] }, key));
|
|
1212
|
-
}) })] })] })
|
|
1124
|
+
}) })] })] }), dialog] }));
|
|
1213
1125
|
}
|
package/lib/app/sections.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** Which section of the Director
|
|
1
|
+
/** Which section of the Director an address opens. Flow has one canvas, and no sections. */
|
|
2
2
|
export type StudioSection = 'create' | 'library' | 'documents' | 'video' | 'music' | 'model3d' | 'queue';
|
|
3
3
|
export declare function parseStudioSection(path?: string): StudioSection;
|
|
4
|
-
export type FlowSection = 'canvas' | 'hybrid' | 'comfy' | 'agents' | 'code' | 'publish';
|
|
5
|
-
export declare function parseFlowSection(path?: string): FlowSection;
|
package/lib/app/sections.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Which section of the Director
|
|
1
|
+
/** Which section of the Director an address opens. Flow has one canvas, and no sections. */
|
|
2
2
|
export function parseStudioSection(path) {
|
|
3
3
|
const clean = (path ?? '').replace(/^\/+|\/+$/g, '').split('/')[0] ?? '';
|
|
4
4
|
if (clean === 'create' || clean === 'refine' || clean === 'home')
|
|
@@ -17,10 +17,3 @@ export function parseStudioSection(path) {
|
|
|
17
17
|
return 'queue';
|
|
18
18
|
return 'create';
|
|
19
19
|
}
|
|
20
|
-
export function parseFlowSection(path) {
|
|
21
|
-
const clean = (path ?? '').replace(/^\/+|\/+$/g, '').split('/')[0] ?? '';
|
|
22
|
-
if (clean === 'hybrid' || clean === 'comfy' || clean === 'agents' || clean === 'code' || clean === 'publish') {
|
|
23
|
-
return clean;
|
|
24
|
-
}
|
|
25
|
-
return 'canvas';
|
|
26
|
-
}
|
package/lib/attach.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The one sentence for files that did not attach: which, and that they were left out (only what was stored is
|
|
3
|
+
* attached), never the server's own words. '' when all did.
|
|
4
|
+
*/
|
|
5
|
+
export declare function uploadFailure(names: string[]): string;
|