@hanzo/studio 0.1.8 → 0.1.12

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.
Files changed (49) hide show
  1. package/lib/app/director.d.ts +134 -0
  2. package/lib/app/director.js +1196 -0
  3. package/lib/app/flow-run.d.ts +34 -0
  4. package/lib/app/flow-run.js +77 -0
  5. package/lib/app/flow.d.ts +58 -0
  6. package/lib/app/flow.js +1213 -0
  7. package/lib/app/sections.d.ts +5 -0
  8. package/lib/app/sections.js +26 -0
  9. package/lib/attach.d.ts +2 -0
  10. package/lib/attach.js +7 -0
  11. package/lib/chat/turn.js +19 -11
  12. package/lib/desk.d.ts +1 -1
  13. package/lib/desk.js +370 -14
  14. package/lib/download.d.ts +2 -0
  15. package/lib/download.js +11 -0
  16. package/lib/gpu.d.ts +13 -1
  17. package/lib/gpu.js +39 -16
  18. package/lib/handoff.d.ts +2 -0
  19. package/lib/handoff.js +2 -0
  20. package/lib/home.d.ts +3 -1
  21. package/lib/home.js +98 -9
  22. package/lib/index.d.ts +7 -0
  23. package/lib/index.js +6 -0
  24. package/lib/kinds/app.d.ts +40 -0
  25. package/lib/kinds/app.js +907 -0
  26. package/lib/kinds/document.js +256 -19
  27. package/lib/kinds/image.d.ts +3 -0
  28. package/lib/kinds/image.js +82 -10
  29. package/lib/kinds/index.js +2 -1
  30. package/lib/kinds/sound.js +109 -10
  31. package/lib/kinds/video.js +146 -17
  32. package/lib/live.d.ts +11 -0
  33. package/lib/live.js +10 -0
  34. package/lib/made.d.ts +2 -1
  35. package/lib/made.js +1 -0
  36. package/lib/pdf.js +1 -1
  37. package/lib/places.d.ts +0 -3
  38. package/lib/places.js +185 -41
  39. package/lib/route.d.ts +18 -0
  40. package/lib/route.js +23 -0
  41. package/lib/starters.d.ts +21 -0
  42. package/lib/starters.js +33 -2
  43. package/lib/studio.js +1 -1
  44. package/lib/talk.js +149 -46
  45. package/lib/ui.d.ts +18 -4
  46. package/lib/ui.js +50 -22
  47. package/lib/wire.d.ts +19 -6
  48. package/lib/wire.js +36 -3
  49. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ import { type Call, type Wire } from '../wire.ts';
2
+ export type RunState = 'queued' | 'running' | 'done' | 'failed';
3
+ /** A submitted graph's state from its work-log row. Only a row the engine closed as done is done; no row is still queued. */
4
+ export declare function runState(row?: {
5
+ status: string;
6
+ }): RunState;
7
+ /**
8
+ * Queue a graph and follow it: `seen` hears each state as it changes, and the
9
+ * last one is answered. A run with no verdict by `wait` ms is still queued or
10
+ * running, never done. Once the job is queued, a work-log that cannot be read
11
+ * is said as such, and is not a failed run. An aborted run says nothing more.
12
+ */
13
+ export declare function run(w: Wire, prompt: object, seen: (state: RunState, note: string) => void, o: {
14
+ signal: AbortSignal;
15
+ every?: number;
16
+ wait?: number;
17
+ }): Promise<RunState>;
18
+ /** The run now in flight: starting another ends the one before, which may then write nothing. */
19
+ export declare function runs(): {
20
+ start(): {
21
+ signal: AbortSignal;
22
+ current: () => boolean;
23
+ };
24
+ stop(): void;
25
+ };
26
+ /** The edit Copilot's tool call asks for, or why there is none. */
27
+ export declare function graphEdit(calls: readonly Call[]): {
28
+ edit: {
29
+ addNodeType?: string;
30
+ autoLayout?: boolean;
31
+ };
32
+ } | {
33
+ why: string;
34
+ };
@@ -0,0 +1,77 @@
1
+ /** What a Flow run and Copilot may say, from what the platform really answered. */
2
+ import { follow } from '../gpu.js';
3
+ import { queuePrompt } from '../wire.js';
4
+ /** A submitted graph's state from its work-log row. Only a row the engine closed as done is done; no row is still queued. */
5
+ export function runState(row) {
6
+ switch (row?.status) {
7
+ case 'done':
8
+ return 'done';
9
+ case 'failed':
10
+ case 'cancelled':
11
+ return 'failed';
12
+ case 'running':
13
+ return 'running';
14
+ default:
15
+ return 'queued';
16
+ }
17
+ }
18
+ /**
19
+ * Queue a graph and follow it: `seen` hears each state as it changes, and the
20
+ * last one is answered. A run with no verdict by `wait` ms is still queued or
21
+ * running, never done. Once the job is queued, a work-log that cannot be read
22
+ * is said as such, and is not a failed run. An aborted run says nothing more.
23
+ */
24
+ export async function run(w, prompt, seen, o) {
25
+ const sent = await queuePrompt(w, prompt, o.signal);
26
+ const id = sent.prompt_id ?? sent.id;
27
+ let last = 'queued';
28
+ if (o.signal.aborted)
29
+ return last;
30
+ seen(last, id ? `Queued as ${id}` : 'Queued, but the platform named no job to follow');
31
+ if (!id)
32
+ return last;
33
+ try {
34
+ await follow(w, id, o, (status, row) => {
35
+ const next = runState({ status });
36
+ if (o.signal.aborted || next === last)
37
+ return;
38
+ seen((last = next), row?.error ?? '');
39
+ });
40
+ }
41
+ catch (e) {
42
+ if (!o.signal.aborted)
43
+ seen(last, `Queued; lost track of progress (${e instanceof Error ? e.message : String(e)})`);
44
+ }
45
+ return last;
46
+ }
47
+ /** The run now in flight: starting another ends the one before, which may then write nothing. */
48
+ export function runs() {
49
+ let now = null;
50
+ return {
51
+ start() {
52
+ now?.abort();
53
+ const ctl = new AbortController();
54
+ now = ctl;
55
+ return { signal: ctl.signal, current: () => now === ctl };
56
+ },
57
+ stop() {
58
+ now?.abort();
59
+ now = null;
60
+ },
61
+ };
62
+ }
63
+ /** The edit Copilot's tool call asks for, or why there is none. */
64
+ export function graphEdit(calls) {
65
+ const call = calls.find((c) => c.name === 'flow_mutate_graph');
66
+ if (!call)
67
+ return { why: 'the model called no graph tool' };
68
+ try {
69
+ const a = JSON.parse(call.args);
70
+ const addNodeType = typeof a.add_node_type === 'string' && a.add_node_type ? a.add_node_type : undefined;
71
+ const autoLayout = a.auto_layout === true ? true : undefined;
72
+ return addNodeType || autoLayout ? { edit: { addNodeType, autoLayout } } : { why: 'the model asked for no edit' };
73
+ }
74
+ catch {
75
+ return { why: 'the model sent an edit that could not be read' };
76
+ }
77
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Hanzo Flow (/flow) — Langflow + ComfyUI Native-Compat Visual Workflow & Node Graph UI.
3
+ *
4
+ * Clean BSD-3-Clause / MIT visual workflow builder that unifies:
5
+ * 1. Langflow Agent, LLM, Prompt Template, RAG Vector Store, MCP Tool, and inline
6
+ * editable Python Component nodes (`flow` backend).
7
+ * 2. Native ComfyUI / `studio_compat` media generation node extensions (`/v1/object_info`,
8
+ * `/v1/prompt`, `/v1/chat/completions` + MCP tools) for Wan 2.2 Video, LTX 2.0, Qwen-Image-Edit 2511,
9
+ * Z-Image-Turbo, Hunyuan3D-2.1 (.glb), ACE-Step 3.5B Music, Demucs Stems, MMAudio Foley,
10
+ * and Kokoro/CosyVoice TTS.
11
+ * 3. Publish any hybrid Agent+ComfyUI graph as a REST endpoint, ComfyUI API JSON,
12
+ * Langflow JSON, or an MCP Server tool.
13
+ */
14
+ import type { Host } from '@hanzo/build';
15
+ import type { RailLink } from '@hanzo/ui/chat';
16
+ import { parseFlowSection, type FlowSection } from './sections.ts';
17
+ export { parseFlowSection, type FlowSection };
18
+ export declare function flowNav(host: Host, go: (path: string) => void): {
19
+ id: 'make';
20
+ label: string;
21
+ links: RailLink[];
22
+ }[];
23
+ export interface FlowModuleSpec {
24
+ type: string;
25
+ title: string;
26
+ family: 'langflow' | 'comfy';
27
+ pack: string;
28
+ category: 'agent' | 'loader' | 'conditioning' | 'sampler' | 'decode' | 'output';
29
+ inputPorts: string[];
30
+ outputPorts: string[];
31
+ defaultInputs: Record<string, string | number>;
32
+ pythonSource: string;
33
+ }
34
+ export declare const FLOW_MODULE_CATALOG: readonly FlowModuleSpec[];
35
+ export interface FlowGraphNode {
36
+ id: string;
37
+ type: string;
38
+ title: string;
39
+ family: 'langflow' | 'comfy';
40
+ category: FlowModuleSpec['category'];
41
+ x: number;
42
+ y: number;
43
+ inputs: Record<string, string | number>;
44
+ wiresFrom: string[];
45
+ pythonCode?: string;
46
+ }
47
+ export interface FlowBlueprint {
48
+ id: string;
49
+ name: string;
50
+ kind: 'Hybrid Langflow + ComfyUI' | 'ComfyUI Video' | 'ComfyUI Image & CAD' | 'ComfyUI 3D Mesh' | 'ComfyUI Audio & Music' | 'Langflow Multi-Agent';
51
+ engine: string;
52
+ description: string;
53
+ nodes: FlowGraphNode[];
54
+ }
55
+ export declare const FLOW_BLUEPRINTS: readonly FlowBlueprint[];
56
+ export declare function FlowStudio({ host }: {
57
+ host: Host;
58
+ }): import("react").JSX.Element;