@genfeedai/workflow-ui 0.2.2 → 0.2.4

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 (47) hide show
  1. package/README.md +11 -33
  2. package/dist/canvas.d.ts +22 -22
  3. package/dist/canvas.mjs +16 -17
  4. package/dist/{chunk-WBR34V4L.mjs → chunk-2FUPL67V.mjs} +1593 -1045
  5. package/dist/{chunk-4VEN4UN7.mjs → chunk-53XDE62A.mjs} +818 -623
  6. package/dist/{chunk-PCIWWD37.mjs → chunk-7LV4UAUS.mjs} +19 -19
  7. package/dist/{chunk-7SKSRSS7.mjs → chunk-B4EAAKYF.mjs} +16 -16
  8. package/dist/{chunk-ZJD5WMR3.mjs → chunk-C6MQBJFC.mjs} +45 -13
  9. package/dist/{chunk-7H3WJJYS.mjs → chunk-ESVULCFY.mjs} +12 -6
  10. package/dist/{chunk-GWBGK3KL.mjs → chunk-FWJIAW2E.mjs} +82 -47
  11. package/dist/{chunk-R727OFBR.mjs → chunk-GPYIIWD5.mjs} +404 -350
  12. package/dist/{chunk-OQREHJXK.mjs → chunk-IYFWAJBB.mjs} +208 -203
  13. package/dist/{chunk-2JQSKIWR.mjs → chunk-MGLAKMDP.mjs} +24 -23
  14. package/dist/{chunk-LT3ZJJL6.mjs → chunk-OJWVEEMM.mjs} +497 -399
  15. package/dist/{chunk-ZD2BADZO.mjs → chunk-ORVDYXDP.mjs} +221 -175
  16. package/dist/{chunk-CV4M7CNU.mjs → chunk-QQVHGJ2G.mjs} +149 -142
  17. package/dist/{chunk-6PSJTBNV.mjs → chunk-U4QPE4CY.mjs} +387 -347
  18. package/dist/{chunk-EFXQT23N.mjs → chunk-VVQ4CH77.mjs} +5 -5
  19. package/dist/{chunk-VRN3UWE5.mjs → chunk-XRC3O5GK.mjs} +73 -73
  20. package/dist/{chunk-FT33LFII.mjs → chunk-YUIK4AHM.mjs} +1 -1
  21. package/dist/{chunk-JT4Y5H3U.mjs → chunk-ZSITTZ4S.mjs} +630 -569
  22. package/dist/hooks.d.ts +37 -37
  23. package/dist/hooks.mjs +10 -10
  24. package/dist/index.d.ts +26 -11
  25. package/dist/index.mjs +99 -20
  26. package/dist/lib.d.ts +203 -203
  27. package/dist/lib.mjs +228 -199
  28. package/dist/nodes.d.ts +2 -2
  29. package/dist/nodes.mjs +12 -13
  30. package/dist/panels.d.ts +2 -3
  31. package/dist/panels.mjs +3 -3
  32. package/dist/provider.d.ts +2 -2
  33. package/dist/provider.mjs +2 -2
  34. package/dist/stores.d.ts +5 -5
  35. package/dist/stores.mjs +5 -5
  36. package/dist/toolbar.d.ts +42 -24
  37. package/dist/toolbar.mjs +4 -5
  38. package/dist/ui.d.ts +2 -2
  39. package/dist/ui.mjs +2 -2
  40. package/dist/{useCommentNavigation-BakbiiIc.d.ts → useRequiredInputs-ByoIS-fT.d.ts} +160 -160
  41. package/dist/{promptLibraryStore-Dl3Q3cP6.d.ts → workflowStore-Bsz0nd5c.d.ts} +368 -368
  42. package/dist/workflowStore-N2F7WIG3.mjs +2 -0
  43. package/package.json +79 -77
  44. package/src/styles/workflow-ui.css +56 -19
  45. package/dist/chunk-OY7BRSGG.mjs +0 -60
  46. package/dist/workflowStore-UAAKOOIK.mjs +0 -2
  47. package/dist/{types-IEKYuYhu.d.ts → types-CRXJnajq.d.ts} +1 -1
package/dist/toolbar.d.ts CHANGED
@@ -1,12 +1,18 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ declare function BottomBar(): react_jsx_runtime.JSX.Element;
5
+
6
+ declare function CostIndicator(): react_jsx_runtime.JSX.Element | null;
2
7
 
3
8
  /**
4
9
  * Toolbar Component Types
5
10
  */
11
+
6
12
  interface DropdownItem {
7
13
  id: string;
8
14
  label?: string;
9
- icon?: React.ReactNode;
15
+ icon?: ReactNode;
10
16
  onClick?: () => void;
11
17
  external?: boolean;
12
18
  separator?: boolean;
@@ -19,7 +25,10 @@ interface ToolbarDropdownProps {
19
25
  interface OverflowMenuProps {
20
26
  items: DropdownItem[];
21
27
  }
22
-
28
+ interface ToolbarMenu {
29
+ label: string;
30
+ items: DropdownItem[];
31
+ }
23
32
  interface ToolbarProps {
24
33
  /** Optional callback for auto-layout functionality */
25
34
  onAutoLayout?: (direction: 'LR' | 'TB') => void;
@@ -30,34 +39,36 @@ interface ToolbarProps {
30
39
  /** Additional file menu items to append */
31
40
  fileMenuItemsAppend?: DropdownItem[];
32
41
  /** Additional menu dropdowns to render after File */
33
- additionalMenus?: Array<{
34
- label: string;
35
- items: DropdownItem[];
36
- }>;
42
+ additionalMenus?: ToolbarMenu[];
43
+ /** Optional custom branding; falls back to the default logo link */
44
+ branding?: ReactNode;
45
+ /** Optional content rendered between branding and the File menu */
46
+ leftContent?: ReactNode;
47
+ /** Optional content rendered after the save indicator and before the spacer */
48
+ middleContent?: ReactNode;
49
+ /** Additional elements to render in the right side of the toolbar */
50
+ rightContent?: ReactNode;
51
+ /** Custom save indicator override */
52
+ saveIndicator?: ReactNode;
37
53
  /** Logo href (defaults to "/") */
38
54
  logoHref?: string;
39
55
  /** Logo image src */
40
56
  logoSrc?: string;
41
57
  /** Whether to show the settings button */
42
58
  showSettings?: boolean;
43
- /** Additional elements to render in the right side of the toolbar */
44
- rightContent?: React.ReactNode;
59
+ /** Whether to show the shortcut help button */
60
+ showShortcutHelp?: boolean;
61
+ }
62
+ interface SaveIndicatorProps {
63
+ isDirty?: boolean;
64
+ isSaving?: boolean;
65
+ variant?: 'default' | 'pill';
45
66
  }
46
- declare function Toolbar({ onAutoLayout, onSaveAs, fileMenuItemsPrepend, fileMenuItemsAppend, additionalMenus, logoHref, logoSrc, showSettings, rightContent, }: ToolbarProps): react_jsx_runtime.JSX.Element;
47
-
48
- declare function BottomBar(): react_jsx_runtime.JSX.Element;
49
-
50
- declare function CostIndicator(): react_jsx_runtime.JSX.Element | null;
51
-
52
- /**
53
- * Auto-save status indicator
54
- */
55
- declare function SaveIndicator(): react_jsx_runtime.JSX.Element;
56
67
 
57
68
  /**
58
- * Toolbar dropdown menu component
69
+ * Overflow menu with icon trigger
59
70
  */
60
- declare function ToolbarDropdown({ label, items }: ToolbarDropdownProps): react_jsx_runtime.JSX.Element;
71
+ declare function OverflowMenu({ items }: OverflowMenuProps): react_jsx_runtime.JSX.Element;
61
72
 
62
73
  interface SaveAsDialogProps {
63
74
  isOpen: boolean;
@@ -65,11 +76,18 @@ interface SaveAsDialogProps {
65
76
  onSave: (newName: string) => void;
66
77
  onClose: () => void;
67
78
  }
68
- declare function SaveAsDialog({ isOpen, currentName, onSave, onClose }: SaveAsDialogProps): react_jsx_runtime.JSX.Element | null;
79
+ declare function SaveAsDialog({ isOpen, currentName, onSave, onClose, }: SaveAsDialogProps): react_jsx_runtime.JSX.Element | null;
69
80
 
70
81
  /**
71
- * Overflow menu with icon trigger
82
+ * Auto-save status indicator
72
83
  */
73
- declare function OverflowMenu({ items }: OverflowMenuProps): react_jsx_runtime.JSX.Element;
84
+ declare function SaveIndicator({ isDirty: isDirtyProp, isSaving: isSavingProp, variant, }: SaveIndicatorProps): react_jsx_runtime.JSX.Element;
85
+
86
+ declare function Toolbar({ onAutoLayout, onSaveAs, fileMenuItemsPrepend, fileMenuItemsAppend, additionalMenus, branding, leftContent, middleContent, saveIndicator, logoHref, logoSrc, showSettings, showShortcutHelp, rightContent, }: ToolbarProps): react_jsx_runtime.JSX.Element;
87
+
88
+ /**
89
+ * Toolbar dropdown menu component
90
+ */
91
+ declare function ToolbarDropdown({ label, items }: ToolbarDropdownProps): react_jsx_runtime.JSX.Element;
74
92
 
75
- export { BottomBar, CostIndicator, type DropdownItem, OverflowMenu, type OverflowMenuProps, SaveAsDialog, SaveIndicator, Toolbar, ToolbarDropdown, type ToolbarDropdownProps };
93
+ export { BottomBar, CostIndicator, type DropdownItem, OverflowMenu, type OverflowMenuProps, SaveAsDialog, SaveIndicator, type SaveIndicatorProps, Toolbar, ToolbarDropdown, type ToolbarDropdownProps, type ToolbarMenu, type ToolbarProps };
package/dist/toolbar.mjs CHANGED
@@ -1,6 +1,5 @@
1
- export { BottomBar, CostIndicator, OverflowMenu, SaveAsDialog, SaveIndicator, Toolbar, ToolbarDropdown } from './chunk-JT4Y5H3U.mjs';
2
- import './chunk-2JQSKIWR.mjs';
3
- import './chunk-OY7BRSGG.mjs';
1
+ export { BottomBar, CostIndicator, OverflowMenu, SaveAsDialog, SaveIndicator, Toolbar, ToolbarDropdown } from './chunk-ZSITTZ4S.mjs';
2
+ import './chunk-MGLAKMDP.mjs';
4
3
  import './chunk-LDN7IX4Y.mjs';
5
- import './chunk-LT3ZJJL6.mjs';
6
- import './chunk-R727OFBR.mjs';
4
+ import './chunk-OJWVEEMM.mjs';
5
+ import './chunk-GPYIIWD5.mjs';
package/dist/ui.d.ts CHANGED
@@ -9,8 +9,8 @@ import * as SliderPrimitive from '@radix-ui/react-slider';
9
9
  import { ClassValue } from 'clsx';
10
10
 
11
11
  declare const buttonVariants: (props?: ({
12
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
13
- size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
12
+ size?: "default" | "icon" | "sm" | "icon-lg" | "icon-sm" | "lg" | null | undefined;
13
+ variant?: "link" | "default" | "destructive" | "ghost" | "outline" | "secondary" | null | undefined;
14
14
  } & class_variance_authority_types.ClassProp) | undefined) => string;
15
15
  declare function Button({ className, variant, size, asChild, ...props }: react.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
16
16
  asChild?: boolean;
package/dist/ui.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { Checkbox, ComparisonSlider, GridPositionSelector, Input, Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Slider } from './chunk-ZJD5WMR3.mjs';
2
- export { Button, buttonVariants, cn } from './chunk-7SKSRSS7.mjs';
1
+ export { Checkbox, ComparisonSlider, GridPositionSelector, Input, Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Slider } from './chunk-C6MQBJFC.mjs';
2
+ export { Button, buttonVariants, cn } from './chunk-B4EAAKYF.mjs';
@@ -1,64 +1,79 @@
1
- import { NodeGroup, WorkflowNode, NodeType, WorkflowNodeData, ProviderModel, SelectedModel, AvailableVariable } from '@genfeedai/types';
2
- import { FitViewOptions } from '@xyflow/react';
1
+ import { WorkflowNodeData, SelectedModel, ProviderModel, NodeType, NodeGroup, WorkflowNode, AvailableVariable } from '@genfeedai/types';
3
2
  import * as react from 'react';
4
3
  import { ReactNode, RefObject } from 'react';
4
+ import { FitViewOptions } from '@xyflow/react';
5
5
 
6
- interface UseCanvasKeyboardShortcutsParams {
7
- selectedNodeIds: string[];
8
- groups: NodeGroup[];
9
- nodes: WorkflowNode[];
10
- toggleNodeLock: (nodeId: string) => void;
11
- createGroup: (nodeIds: string[]) => string;
12
- deleteGroup: (groupId: string) => void;
13
- unlockAllNodes: () => void;
14
- addNode: (type: NodeType, position: {
15
- x: number;
16
- y: number;
17
- }) => string;
18
- togglePalette: () => void;
19
- fitView: (options?: FitViewOptions) => void;
20
- openShortcutHelp: () => void;
21
- openNodeSearch: () => void;
22
- deleteSelectedElements: () => void;
23
- }
24
6
  /**
25
- * Hook that handles keyboard shortcuts for the workflow canvas
26
- *
27
- * Shortcuts:
28
- * - M: Toggle sidebar/palette
29
- * - L: Toggle lock on selected nodes
30
- * - F: Fit view to selection (or all if none selected)
31
- * - ?: Show shortcut help modal
32
- * - Ctrl/Cmd+F: Open node search
33
- * - Ctrl/Cmd+G: Create group from selection
34
- * - Ctrl/Cmd+Shift+G: Ungroup selected nodes
35
- * - Ctrl/Cmd+Shift+L: Unlock all nodes
36
- * - Shift+I: Add image generator node
37
- * - Shift+V: Add video generator node
38
- * - Shift+P: Add prompt node
39
- * - Shift+L: Add LLM node
40
- * - Ctrl/Cmd+Z: Undo
41
- * - Ctrl/Cmd+Shift+Z: Redo
7
+ * JSON Schema property definition
8
+ * These come from Replicate model schemas
42
9
  */
43
- declare function useCanvasKeyboardShortcuts({ selectedNodeIds, groups, nodes, toggleNodeLock, createGroup, deleteGroup, unlockAllNodes, addNode, togglePalette, fitView, openShortcutHelp, openNodeSearch, deleteSelectedElements, }: UseCanvasKeyboardShortcutsParams): void;
10
+ interface SchemaProperty {
11
+ type?: string;
12
+ title?: string;
13
+ description?: string;
14
+ default?: unknown;
15
+ minimum?: number;
16
+ maximum?: number;
17
+ 'x-order'?: number;
18
+ allOf?: Array<{
19
+ $ref: string;
20
+ }>;
21
+ enum?: string[];
22
+ nullable?: boolean;
23
+ }
44
24
 
45
- interface RequiredInputsResult {
46
- /** Whether all required inputs have connections */
47
- hasRequiredInputs: boolean;
48
- /** List of missing required input handle IDs */
49
- missingInputs: string[];
50
- /** Map of handle ID to whether it's connected */
51
- connectionStatus: Map<string, boolean>;
25
+ interface UseAIGenNodeOptions {
26
+ nodeId: string;
27
+ selectedModel: SelectedModel | undefined;
28
+ schemaParams: Record<string, unknown> | undefined;
29
+ }
30
+ declare function useAIGenNode<TNodeData extends WorkflowNodeData>({ nodeId, selectedModel, schemaParams, }: UseAIGenNodeOptions): {
31
+ componentSchemas: Record<string, {
32
+ enum?: unknown[];
33
+ type?: string;
34
+ }> | undefined;
35
+ enumValues: Record<string, string[]> | undefined;
36
+ handleSchemaParamChange: (key: string, value: unknown) => void;
37
+ modelSupportsImageInput: boolean;
38
+ schemaProperties: Record<string, SchemaProperty> | undefined;
39
+ };
40
+
41
+ interface UseAIGenNodeHeaderOptions {
42
+ modelDisplayName: string;
43
+ isProcessing: boolean;
44
+ canGenerate: boolean;
45
+ hasOutput: boolean;
46
+ onModelBrowse: () => void;
47
+ onGenerate: () => void;
48
+ onStop: () => void;
49
+ onExpand: () => void;
50
+ }
51
+ declare function useAIGenNodeHeader({ modelDisplayName, isProcessing, canGenerate, hasOutput, onModelBrowse, onGenerate, onStop, onExpand, }: UseAIGenNodeHeaderOptions): {
52
+ titleElement: ReactNode;
53
+ headerActions: ReactNode;
54
+ };
55
+
56
+ interface UseAutoLoadModelSchemaOptions<TModel extends string> {
57
+ /** Current model type from node data */
58
+ currentModel: TModel | undefined;
59
+ /** Selected model with full schema (if already loaded) */
60
+ selectedModel: SelectedModel | undefined;
61
+ /** Map from internal model type to API model ID */
62
+ modelIdMap: Record<TModel, string>;
63
+ /** Callback when model is loaded from API */
64
+ onModelSelect: (model: ProviderModel) => void;
52
65
  }
53
66
  /**
54
- * Hook that checks if all required inputs for a node are connected.
55
- * Uses edge connections, not actual data values.
67
+ * Hook that auto-loads model schema for a node when the selectedModel is not set
68
+ * but a model type is already selected.
56
69
  *
57
- * @param nodeId - The node ID to check
58
- * @param nodeType - The node type (to look up required inputs from NODE_DEFINITIONS)
59
- * @returns Object with hasRequiredInputs boolean and details about missing inputs
70
+ * This handles the case where a node has a default model but hasn't loaded
71
+ * the full schema yet.
72
+ *
73
+ * Uses the WorkflowUIProvider's modelSchema service to fetch the schema.
74
+ * Falls back to no-op if the service is not configured.
60
75
  */
61
- declare function useRequiredInputs(nodeId: string, nodeType: NodeType): RequiredInputsResult;
76
+ declare function useAutoLoadModelSchema<TModel extends string>({ currentModel, selectedModel, modelIdMap, onModelSelect, }: UseAutoLoadModelSchemaOptions<TModel>): void;
62
77
 
63
78
  interface MissingItem {
64
79
  type: 'connection' | 'data' | 'schema';
@@ -99,21 +114,77 @@ interface UseCanGenerateOptions {
99
114
  */
100
115
  declare function useCanGenerate({ nodeId, nodeType, inputSchema, schemaParams, }: UseCanGenerateOptions): CanGenerateResult;
101
116
 
117
+ interface UseCanvasKeyboardShortcutsParams {
118
+ selectedNodeIds: string[];
119
+ groups: NodeGroup[];
120
+ nodes: WorkflowNode[];
121
+ toggleNodeLock: (nodeId: string) => void;
122
+ createGroup: (nodeIds: string[]) => string;
123
+ deleteGroup: (groupId: string) => void;
124
+ unlockAllNodes: () => void;
125
+ addNode: (type: NodeType, position: {
126
+ x: number;
127
+ y: number;
128
+ }) => string;
129
+ togglePalette: () => void;
130
+ fitView: (options?: FitViewOptions) => void;
131
+ openShortcutHelp: () => void;
132
+ openNodeSearch: () => void;
133
+ deleteSelectedElements: () => void;
134
+ }
102
135
  /**
103
- * Hook for triggering and stopping node execution
104
- *
105
- * Encapsulates the common pattern of:
106
- * 1. Setting node status to processing
107
- * 2. Triggering execution
108
- * 3. Stopping execution and resetting status
136
+ * Hook that handles keyboard shortcuts for the workflow canvas
109
137
  *
110
- * @param nodeId - The ID of the node to execute
111
- * @returns handleGenerate - Callback to trigger node execution
112
- * @returns handleStop - Callback to stop node execution
138
+ * Shortcuts:
139
+ * - M: Toggle sidebar/palette
140
+ * - L: Toggle lock on selected nodes
141
+ * - F: Fit view to selection (or all if none selected)
142
+ * - ?: Show shortcut help modal
143
+ * - Ctrl/Cmd+F: Open node search
144
+ * - Ctrl/Cmd+G: Create group from selection
145
+ * - Ctrl/Cmd+Shift+G: Ungroup selected nodes
146
+ * - Ctrl/Cmd+Shift+L: Unlock all nodes
147
+ * - Shift+I: Add image generator node
148
+ * - Shift+V: Add video generator node
149
+ * - Shift+P: Add prompt node
150
+ * - Shift+L: Add LLM node
151
+ * - Ctrl/Cmd+Z: Undo
152
+ * - Ctrl/Cmd+Shift+Z: Redo
113
153
  */
114
- declare function useNodeExecution(nodeId: string): {
115
- handleGenerate: () => void;
116
- handleStop: () => void;
154
+ declare function useCanvasKeyboardShortcuts({ selectedNodeIds, groups, nodes, toggleNodeLock, createGroup, deleteGroup, unlockAllNodes, addNode, togglePalette, fitView, openShortcutHelp, openNodeSearch, deleteSelectedElements, }: UseCanvasKeyboardShortcutsParams): void;
155
+
156
+ interface CommentNavigation {
157
+ currentIndex: number;
158
+ totalCount: number;
159
+ onPrevious: () => void;
160
+ onNext: () => void;
161
+ }
162
+ /**
163
+ * Hook that provides navigation props for nodes with comments.
164
+ * Returns null if the node has no comment.
165
+ */
166
+ declare function useCommentNavigation(nodeId: string): CommentNavigation | null;
167
+
168
+ interface UseMediaUploadOptions<T extends WorkflowNodeData> {
169
+ nodeId: string;
170
+ mediaType: 'image' | 'video';
171
+ initialUrl?: string;
172
+ getMetadata: (src: string) => Promise<Record<string, unknown>>;
173
+ buildUploadUpdate: (url: string, filename: string, metadata: Record<string, unknown>) => Partial<T>;
174
+ buildUrlUpdate: (url: string, metadata: Record<string, unknown> | null) => Partial<T>;
175
+ buildRemoveUpdate: () => Partial<T>;
176
+ }
177
+ declare function useMediaUpload<T extends WorkflowNodeData>({ nodeId, mediaType, initialUrl, getMetadata, buildUploadUpdate, buildUrlUpdate, buildRemoveUpdate, }: UseMediaUploadOptions<T>): {
178
+ fileInputRef: react.RefObject<HTMLInputElement | null>;
179
+ handleFileSelect: (e: React.ChangeEvent<HTMLInputElement>) => Promise<void>;
180
+ handleRemove: () => void;
181
+ handleUrlKeyDown: (e: React.KeyboardEvent) => void;
182
+ handleUrlSubmit: () => Promise<void>;
183
+ isUploading: boolean;
184
+ setShowUrlInput: react.Dispatch<react.SetStateAction<boolean>>;
185
+ setUrlValue: react.Dispatch<react.SetStateAction<string>>;
186
+ showUrlInput: boolean;
187
+ urlValue: string;
117
188
  };
118
189
 
119
190
  type ModelMap = Record<string, string>;
@@ -138,53 +209,20 @@ declare function useModelSelection<TModel extends string, TNodeData extends Work
138
209
  };
139
210
 
140
211
  /**
141
- * JSON Schema property definition
142
- * These come from Replicate model schemas
212
+ * Hook for triggering and stopping node execution
213
+ *
214
+ * Encapsulates the common pattern of:
215
+ * 1. Setting node status to processing
216
+ * 2. Triggering execution
217
+ * 3. Stopping execution and resetting status
218
+ *
219
+ * @param nodeId - The ID of the node to execute
220
+ * @returns handleGenerate - Callback to trigger node execution
221
+ * @returns handleStop - Callback to stop node execution
143
222
  */
144
- interface SchemaProperty {
145
- type?: string;
146
- title?: string;
147
- description?: string;
148
- default?: unknown;
149
- minimum?: number;
150
- maximum?: number;
151
- 'x-order'?: number;
152
- allOf?: Array<{
153
- $ref: string;
154
- }>;
155
- enum?: string[];
156
- nullable?: boolean;
157
- }
158
-
159
- interface UseAIGenNodeOptions {
160
- nodeId: string;
161
- selectedModel: SelectedModel | undefined;
162
- schemaParams: Record<string, unknown> | undefined;
163
- }
164
- declare function useAIGenNode<TNodeData extends WorkflowNodeData>({ nodeId, selectedModel, schemaParams, }: UseAIGenNodeOptions): {
165
- schemaProperties: Record<string, SchemaProperty> | undefined;
166
- enumValues: Record<string, string[]> | undefined;
167
- modelSupportsImageInput: boolean;
168
- handleSchemaParamChange: (key: string, value: unknown) => void;
169
- componentSchemas: Record<string, {
170
- enum?: unknown[];
171
- type?: string;
172
- }> | undefined;
173
- };
174
-
175
- interface UseAIGenNodeHeaderOptions {
176
- modelDisplayName: string;
177
- isProcessing: boolean;
178
- canGenerate: boolean;
179
- hasOutput: boolean;
180
- onModelBrowse: () => void;
181
- onGenerate: () => void;
182
- onStop: () => void;
183
- onExpand: () => void;
184
- }
185
- declare function useAIGenNodeHeader({ modelDisplayName, isProcessing, canGenerate, hasOutput, onModelBrowse, onGenerate, onStop, onExpand, }: UseAIGenNodeHeaderOptions): {
186
- titleElement: ReactNode;
187
- headerActions: ReactNode;
223
+ declare function useNodeExecution(nodeId: string): {
224
+ handleGenerate: () => void;
225
+ handleStop: () => void;
188
226
  };
189
227
 
190
228
  interface UsePromptAutocompleteOptions {
@@ -209,60 +247,22 @@ interface UsePromptAutocompleteReturn {
209
247
  }
210
248
  declare function usePromptAutocomplete({ availableVariables, textareaRef, localTemplate, setLocalTemplate, onTemplateCommit, }: UsePromptAutocompleteOptions): UsePromptAutocompleteReturn;
211
249
 
212
- interface UseMediaUploadOptions<T extends WorkflowNodeData> {
213
- nodeId: string;
214
- mediaType: 'image' | 'video';
215
- initialUrl?: string;
216
- getMetadata: (src: string) => Promise<Record<string, unknown>>;
217
- buildUploadUpdate: (url: string, filename: string, metadata: Record<string, unknown>) => Partial<T>;
218
- buildUrlUpdate: (url: string, metadata: Record<string, unknown> | null) => Partial<T>;
219
- buildRemoveUpdate: () => Partial<T>;
220
- }
221
- declare function useMediaUpload<T extends WorkflowNodeData>({ nodeId, mediaType, initialUrl, getMetadata, buildUploadUpdate, buildUrlUpdate, buildRemoveUpdate, }: UseMediaUploadOptions<T>): {
222
- fileInputRef: react.RefObject<HTMLInputElement | null>;
223
- showUrlInput: boolean;
224
- setShowUrlInput: react.Dispatch<react.SetStateAction<boolean>>;
225
- urlValue: string;
226
- setUrlValue: react.Dispatch<react.SetStateAction<string>>;
227
- isUploading: boolean;
228
- handleFileSelect: (e: React.ChangeEvent<HTMLInputElement>) => Promise<void>;
229
- handleRemove: () => void;
230
- handleUrlSubmit: () => Promise<void>;
231
- handleUrlKeyDown: (e: React.KeyboardEvent) => void;
232
- };
233
-
234
- interface UseAutoLoadModelSchemaOptions<TModel extends string> {
235
- /** Current model type from node data */
236
- currentModel: TModel | undefined;
237
- /** Selected model with full schema (if already loaded) */
238
- selectedModel: SelectedModel | undefined;
239
- /** Map from internal model type to API model ID */
240
- modelIdMap: Record<TModel, string>;
241
- /** Callback when model is loaded from API */
242
- onModelSelect: (model: ProviderModel) => void;
250
+ interface RequiredInputsResult {
251
+ /** Whether all required inputs have connections */
252
+ hasRequiredInputs: boolean;
253
+ /** List of missing required input handle IDs */
254
+ missingInputs: string[];
255
+ /** Map of handle ID to whether it's connected */
256
+ connectionStatus: Map<string, boolean>;
243
257
  }
244
258
  /**
245
- * Hook that auto-loads model schema for a node when the selectedModel is not set
246
- * but a model type is already selected.
247
- *
248
- * This handles the case where a node has a default model but hasn't loaded
249
- * the full schema yet.
259
+ * Hook that checks if all required inputs for a node are connected.
260
+ * Uses edge connections, not actual data values.
250
261
  *
251
- * Uses the WorkflowUIProvider's modelSchema service to fetch the schema.
252
- * Falls back to no-op if the service is not configured.
253
- */
254
- declare function useAutoLoadModelSchema<TModel extends string>({ currentModel, selectedModel, modelIdMap, onModelSelect, }: UseAutoLoadModelSchemaOptions<TModel>): void;
255
-
256
- interface CommentNavigation {
257
- currentIndex: number;
258
- totalCount: number;
259
- onPrevious: () => void;
260
- onNext: () => void;
261
- }
262
- /**
263
- * Hook that provides navigation props for nodes with comments.
264
- * Returns null if the node has no comment.
262
+ * @param nodeId - The node ID to check
263
+ * @param nodeType - The node type (to look up required inputs from NODE_DEFINITIONS)
264
+ * @returns Object with hasRequiredInputs boolean and details about missing inputs
265
265
  */
266
- declare function useCommentNavigation(nodeId: string): CommentNavigation | null;
266
+ declare function useRequiredInputs(nodeId: string, nodeType: NodeType): RequiredInputsResult;
267
267
 
268
268
  export { type CommentNavigation as C, useAIGenNodeHeader as a, useAutoLoadModelSchema as b, useCanGenerate as c, useCanvasKeyboardShortcuts as d, useCommentNavigation as e, useMediaUpload as f, useModelSelection as g, useNodeExecution as h, usePromptAutocomplete as i, useRequiredInputs as j, useAIGenNode as u };