@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.
- package/README.md +11 -33
- package/dist/canvas.d.ts +22 -22
- package/dist/canvas.mjs +16 -17
- package/dist/{chunk-WBR34V4L.mjs → chunk-2FUPL67V.mjs} +1593 -1045
- package/dist/{chunk-4VEN4UN7.mjs → chunk-53XDE62A.mjs} +818 -623
- package/dist/{chunk-PCIWWD37.mjs → chunk-7LV4UAUS.mjs} +19 -19
- package/dist/{chunk-7SKSRSS7.mjs → chunk-B4EAAKYF.mjs} +16 -16
- package/dist/{chunk-ZJD5WMR3.mjs → chunk-C6MQBJFC.mjs} +45 -13
- package/dist/{chunk-7H3WJJYS.mjs → chunk-ESVULCFY.mjs} +12 -6
- package/dist/{chunk-GWBGK3KL.mjs → chunk-FWJIAW2E.mjs} +82 -47
- package/dist/{chunk-R727OFBR.mjs → chunk-GPYIIWD5.mjs} +404 -350
- package/dist/{chunk-OQREHJXK.mjs → chunk-IYFWAJBB.mjs} +208 -203
- package/dist/{chunk-2JQSKIWR.mjs → chunk-MGLAKMDP.mjs} +24 -23
- package/dist/{chunk-LT3ZJJL6.mjs → chunk-OJWVEEMM.mjs} +497 -399
- package/dist/{chunk-ZD2BADZO.mjs → chunk-ORVDYXDP.mjs} +221 -175
- package/dist/{chunk-CV4M7CNU.mjs → chunk-QQVHGJ2G.mjs} +149 -142
- package/dist/{chunk-6PSJTBNV.mjs → chunk-U4QPE4CY.mjs} +387 -347
- package/dist/{chunk-EFXQT23N.mjs → chunk-VVQ4CH77.mjs} +5 -5
- package/dist/{chunk-VRN3UWE5.mjs → chunk-XRC3O5GK.mjs} +73 -73
- package/dist/{chunk-FT33LFII.mjs → chunk-YUIK4AHM.mjs} +1 -1
- package/dist/{chunk-JT4Y5H3U.mjs → chunk-ZSITTZ4S.mjs} +630 -569
- package/dist/hooks.d.ts +37 -37
- package/dist/hooks.mjs +10 -10
- package/dist/index.d.ts +26 -11
- package/dist/index.mjs +99 -20
- package/dist/lib.d.ts +203 -203
- package/dist/lib.mjs +228 -199
- package/dist/nodes.d.ts +2 -2
- package/dist/nodes.mjs +12 -13
- package/dist/panels.d.ts +2 -3
- package/dist/panels.mjs +3 -3
- package/dist/provider.d.ts +2 -2
- package/dist/provider.mjs +2 -2
- package/dist/stores.d.ts +5 -5
- package/dist/stores.mjs +5 -5
- package/dist/toolbar.d.ts +42 -24
- package/dist/toolbar.mjs +4 -5
- package/dist/ui.d.ts +2 -2
- package/dist/ui.mjs +2 -2
- package/dist/{useCommentNavigation-BakbiiIc.d.ts → useRequiredInputs-ByoIS-fT.d.ts} +160 -160
- package/dist/{promptLibraryStore-Dl3Q3cP6.d.ts → workflowStore-Bsz0nd5c.d.ts} +368 -368
- package/dist/workflowStore-N2F7WIG3.mjs +2 -0
- package/package.json +79 -77
- package/src/styles/workflow-ui.css +56 -19
- package/dist/chunk-OY7BRSGG.mjs +0 -60
- package/dist/workflowStore-UAAKOOIK.mjs +0 -2
- package/dist/{types-IEKYuYhu.d.ts → types-CRXJnajq.d.ts} +1 -1
|
@@ -1,9 +1,270 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import * as _genfeedai_types from '@genfeedai/types';
|
|
3
|
-
import {
|
|
3
|
+
import { ValidationResult, IPrompt, PromptCategory, IQueryPrompts, ICreatePrompt, ProviderType, EdgeStyle, HandleType, WorkflowNode, WorkflowEdge, NodeGroup, NodeType, WorkflowNodeData, GroupColor, WorkflowFile } from '@genfeedai/types';
|
|
4
|
+
import { P as PromptLibraryService } from './types-CRXJnajq.js';
|
|
4
5
|
import * as zundo from 'zundo';
|
|
5
6
|
import { XYPosition, NodeChange, EdgeChange, Connection } from '@xyflow/react';
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
type AnnotationTool = 'select' | 'rectangle' | 'circle' | 'arrow' | 'freehand' | 'text';
|
|
9
|
+
interface ToolOptions {
|
|
10
|
+
strokeColor: string;
|
|
11
|
+
strokeWidth: number;
|
|
12
|
+
fillColor: string | null;
|
|
13
|
+
fontSize: number;
|
|
14
|
+
}
|
|
15
|
+
interface BaseShape {
|
|
16
|
+
id: string;
|
|
17
|
+
type: AnnotationTool;
|
|
18
|
+
strokeColor: string;
|
|
19
|
+
strokeWidth: number;
|
|
20
|
+
fillColor: string | null;
|
|
21
|
+
}
|
|
22
|
+
interface RectangleShape extends BaseShape {
|
|
23
|
+
type: 'rectangle';
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}
|
|
29
|
+
interface CircleShape extends BaseShape {
|
|
30
|
+
type: 'circle';
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
radius: number;
|
|
34
|
+
}
|
|
35
|
+
interface ArrowShape extends BaseShape {
|
|
36
|
+
type: 'arrow';
|
|
37
|
+
points: number[];
|
|
38
|
+
}
|
|
39
|
+
interface FreehandShape extends BaseShape {
|
|
40
|
+
type: 'freehand';
|
|
41
|
+
points: number[];
|
|
42
|
+
}
|
|
43
|
+
interface TextShape extends BaseShape {
|
|
44
|
+
type: 'text';
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
text: string;
|
|
48
|
+
fontSize: number;
|
|
49
|
+
}
|
|
50
|
+
type AnnotationShape = RectangleShape | CircleShape | ArrowShape | FreehandShape | TextShape;
|
|
51
|
+
interface AnnotationStore {
|
|
52
|
+
isOpen: boolean;
|
|
53
|
+
nodeId: string | null;
|
|
54
|
+
sourceImage: string | null;
|
|
55
|
+
shapes: AnnotationShape[];
|
|
56
|
+
selectedShapeId: string | null;
|
|
57
|
+
currentTool: AnnotationTool;
|
|
58
|
+
toolOptions: ToolOptions;
|
|
59
|
+
history: AnnotationShape[][];
|
|
60
|
+
historyIndex: number;
|
|
61
|
+
isDrawing: boolean;
|
|
62
|
+
drawingShape: Partial<AnnotationShape> | null;
|
|
63
|
+
openAnnotation: (nodeId: string, image: string, existingShapes?: AnnotationShape[]) => void;
|
|
64
|
+
closeAnnotation: () => void;
|
|
65
|
+
saveAndClose: () => {
|
|
66
|
+
nodeId: string;
|
|
67
|
+
shapes: AnnotationShape[];
|
|
68
|
+
} | null;
|
|
69
|
+
addShape: (shape: AnnotationShape) => void;
|
|
70
|
+
updateShape: (id: string, updates: Partial<AnnotationShape>) => void;
|
|
71
|
+
deleteShape: (id: string) => void;
|
|
72
|
+
selectShape: (id: string | null) => void;
|
|
73
|
+
clearShapes: () => void;
|
|
74
|
+
setTool: (tool: AnnotationTool) => void;
|
|
75
|
+
setToolOptions: (options: Partial<ToolOptions>) => void;
|
|
76
|
+
startDrawing: (shape: Partial<AnnotationShape>) => void;
|
|
77
|
+
updateDrawing: (updates: Partial<AnnotationShape>) => void;
|
|
78
|
+
finishDrawing: () => void;
|
|
79
|
+
cancelDrawing: () => void;
|
|
80
|
+
undo: () => void;
|
|
81
|
+
redo: () => void;
|
|
82
|
+
canUndo: () => boolean;
|
|
83
|
+
canRedo: () => boolean;
|
|
84
|
+
}
|
|
85
|
+
declare const useAnnotationStore: zustand.UseBoundStore<zustand.StoreApi<AnnotationStore>>;
|
|
86
|
+
|
|
87
|
+
interface DebugPayload {
|
|
88
|
+
nodeId: string;
|
|
89
|
+
nodeName: string;
|
|
90
|
+
nodeType: string;
|
|
91
|
+
model: string;
|
|
92
|
+
input: Record<string, unknown>;
|
|
93
|
+
timestamp: string;
|
|
94
|
+
}
|
|
95
|
+
interface Job {
|
|
96
|
+
nodeId: string;
|
|
97
|
+
predictionId: string;
|
|
98
|
+
status: 'pending' | 'processing' | 'succeeded' | 'failed' | 'canceled';
|
|
99
|
+
progress: number;
|
|
100
|
+
output: unknown | null;
|
|
101
|
+
error: string | null;
|
|
102
|
+
createdAt: string;
|
|
103
|
+
}
|
|
104
|
+
interface NodeExecution {
|
|
105
|
+
executionId: string;
|
|
106
|
+
nodeIds: string[];
|
|
107
|
+
eventSource: EventSource;
|
|
108
|
+
}
|
|
109
|
+
interface ExecutionState {
|
|
110
|
+
isRunning: boolean;
|
|
111
|
+
executionId: string | null;
|
|
112
|
+
currentNodeId: string | null;
|
|
113
|
+
/** Node IDs being executed (for partial execution). Empty = all nodes */
|
|
114
|
+
executingNodeIds: string[];
|
|
115
|
+
validationErrors: ValidationResult | null;
|
|
116
|
+
eventSource: EventSource | null;
|
|
117
|
+
lastFailedNodeId: string | null;
|
|
118
|
+
pausedAtNodeId: string | null;
|
|
119
|
+
jobs: Map<string, Job>;
|
|
120
|
+
estimatedCost: number;
|
|
121
|
+
actualCost: number;
|
|
122
|
+
debugPayloads: DebugPayload[];
|
|
123
|
+
/** Independent per-node executions (Generate button clicks) */
|
|
124
|
+
activeNodeExecutions: Map<string, NodeExecution>;
|
|
125
|
+
}
|
|
126
|
+
interface ExecutionActions {
|
|
127
|
+
executeWorkflow: () => Promise<void>;
|
|
128
|
+
executeSelectedNodes: () => Promise<void>;
|
|
129
|
+
executeNode: (nodeId: string) => Promise<void>;
|
|
130
|
+
resumeFromFailed: () => Promise<void>;
|
|
131
|
+
stopExecution: () => void;
|
|
132
|
+
stopNodeExecution: (nodeId: string) => void;
|
|
133
|
+
isNodeExecuting: (nodeId: string) => boolean;
|
|
134
|
+
clearValidationErrors: () => void;
|
|
135
|
+
}
|
|
136
|
+
interface JobActions {
|
|
137
|
+
addJob: (nodeId: string, predictionId: string) => void;
|
|
138
|
+
updateJob: (predictionId: string, updates: Partial<Job>) => void;
|
|
139
|
+
getJobByNodeId: (nodeId: string) => Job | undefined;
|
|
140
|
+
}
|
|
141
|
+
interface HelperActions$1 {
|
|
142
|
+
resetExecution: () => void;
|
|
143
|
+
canResumeFromFailed: () => boolean;
|
|
144
|
+
setEstimatedCost: (cost: number) => void;
|
|
145
|
+
addDebugPayload: (payload: DebugPayload) => void;
|
|
146
|
+
clearDebugPayloads: () => void;
|
|
147
|
+
}
|
|
148
|
+
interface ExecutionStore extends ExecutionState, ExecutionActions, JobActions, HelperActions$1 {
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Execution Store
|
|
153
|
+
*
|
|
154
|
+
* Manages workflow execution state including jobs, validation, and SSE subscriptions.
|
|
155
|
+
* Split into slices for maintainability:
|
|
156
|
+
*
|
|
157
|
+
* - executionSlice: Core execution operations (run, stop, resume)
|
|
158
|
+
* - jobSlice: Job tracking and management
|
|
159
|
+
*/
|
|
160
|
+
declare const useExecutionStore: zustand.UseBoundStore<zustand.StoreApi<ExecutionStore>>;
|
|
161
|
+
|
|
162
|
+
interface PromptEditorStore {
|
|
163
|
+
isOpen: boolean;
|
|
164
|
+
nodeId: string | null;
|
|
165
|
+
prompt: string;
|
|
166
|
+
fontSize: number;
|
|
167
|
+
openEditor: (nodeId: string, prompt: string) => void;
|
|
168
|
+
closeEditor: () => void;
|
|
169
|
+
setPrompt: (prompt: string) => void;
|
|
170
|
+
setFontSize: (size: number) => void;
|
|
171
|
+
saveAndClose: () => {
|
|
172
|
+
nodeId: string;
|
|
173
|
+
prompt: string;
|
|
174
|
+
} | null;
|
|
175
|
+
}
|
|
176
|
+
declare const usePromptEditorStore: zustand.UseBoundStore<zustand.StoreApi<PromptEditorStore>>;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Configure the prompt library store with an API service.
|
|
180
|
+
* Called by WorkflowUIProvider when a promptLibrary service is provided.
|
|
181
|
+
*
|
|
182
|
+
* This pattern is used because Zustand stores exist outside the React tree
|
|
183
|
+
* and cannot use useContext directly.
|
|
184
|
+
*/
|
|
185
|
+
declare function configurePromptLibrary(api: PromptLibraryService): void;
|
|
186
|
+
interface PromptLibraryStore {
|
|
187
|
+
items: IPrompt[];
|
|
188
|
+
featuredItems: IPrompt[];
|
|
189
|
+
selectedItem: IPrompt | null;
|
|
190
|
+
isLoading: boolean;
|
|
191
|
+
error: string | null;
|
|
192
|
+
searchQuery: string;
|
|
193
|
+
categoryFilter: PromptCategory | null;
|
|
194
|
+
isPickerOpen: boolean;
|
|
195
|
+
isCreateModalOpen: boolean;
|
|
196
|
+
editingItem: IPrompt | null;
|
|
197
|
+
setSearchQuery: (query: string) => void;
|
|
198
|
+
setCategoryFilter: (category: PromptCategory | null) => void;
|
|
199
|
+
setSelectedItem: (item: IPrompt | null) => void;
|
|
200
|
+
openPicker: () => void;
|
|
201
|
+
closePicker: () => void;
|
|
202
|
+
openCreateModal: (editItem?: IPrompt) => void;
|
|
203
|
+
closeCreateModal: () => void;
|
|
204
|
+
loadItems: (query?: IQueryPrompts, signal?: AbortSignal) => Promise<void>;
|
|
205
|
+
loadFeatured: (signal?: AbortSignal) => Promise<void>;
|
|
206
|
+
createItem: (data: ICreatePrompt, signal?: AbortSignal) => Promise<IPrompt>;
|
|
207
|
+
updateItem: (id: string, data: Partial<ICreatePrompt>, signal?: AbortSignal) => Promise<IPrompt>;
|
|
208
|
+
deleteItem: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
209
|
+
duplicateItem: (id: string, signal?: AbortSignal) => Promise<IPrompt>;
|
|
210
|
+
recordItemUsage: (id: string, signal?: AbortSignal) => Promise<IPrompt>;
|
|
211
|
+
}
|
|
212
|
+
declare const usePromptLibraryStore: zustand.UseBoundStore<zustand.StoreApi<PromptLibraryStore>>;
|
|
213
|
+
|
|
214
|
+
interface ProviderConfig {
|
|
215
|
+
apiKey: string | null;
|
|
216
|
+
enabled: boolean;
|
|
217
|
+
}
|
|
218
|
+
interface ProviderSettings {
|
|
219
|
+
replicate: ProviderConfig;
|
|
220
|
+
fal: ProviderConfig;
|
|
221
|
+
huggingface: ProviderConfig;
|
|
222
|
+
'genfeed-ai': ProviderConfig;
|
|
223
|
+
}
|
|
224
|
+
interface DefaultModelSettings {
|
|
225
|
+
imageModel: string;
|
|
226
|
+
imageProvider: ProviderType;
|
|
227
|
+
videoModel: string;
|
|
228
|
+
videoProvider: ProviderType;
|
|
229
|
+
}
|
|
230
|
+
interface RecentModel {
|
|
231
|
+
id: string;
|
|
232
|
+
displayName: string;
|
|
233
|
+
provider: ProviderType;
|
|
234
|
+
timestamp: number;
|
|
235
|
+
}
|
|
236
|
+
interface SettingsStore {
|
|
237
|
+
providers: ProviderSettings;
|
|
238
|
+
defaults: DefaultModelSettings;
|
|
239
|
+
edgeStyle: EdgeStyle;
|
|
240
|
+
showMinimap: boolean;
|
|
241
|
+
autoSaveEnabled: boolean;
|
|
242
|
+
recentModels: RecentModel[];
|
|
243
|
+
hasSeenWelcome: boolean;
|
|
244
|
+
debugMode: boolean;
|
|
245
|
+
toggleAutoSave: () => void;
|
|
246
|
+
setDebugMode: (enabled: boolean) => void;
|
|
247
|
+
setProviderKey: (provider: ProviderType, key: string | null) => void;
|
|
248
|
+
setProviderEnabled: (provider: ProviderType, enabled: boolean) => void;
|
|
249
|
+
setDefaultModel: (type: 'image' | 'video', model: string, provider: ProviderType) => void;
|
|
250
|
+
setEdgeStyle: (style: EdgeStyle) => void;
|
|
251
|
+
setShowMinimap: (show: boolean) => void;
|
|
252
|
+
addRecentModel: (model: Omit<RecentModel, 'timestamp'>) => void;
|
|
253
|
+
clearProviderKey: (provider: ProviderType) => void;
|
|
254
|
+
clearAllKeys: () => void;
|
|
255
|
+
setHasSeenWelcome: (seen: boolean) => void;
|
|
256
|
+
isProviderConfigured: (provider: ProviderType) => boolean;
|
|
257
|
+
getProviderHeader: (provider: ProviderType) => Record<string, string>;
|
|
258
|
+
isSyncing: boolean;
|
|
259
|
+
syncFromServer: () => Promise<void>;
|
|
260
|
+
syncToServer: () => Promise<void>;
|
|
261
|
+
}
|
|
262
|
+
declare const useSettingsStore: zustand.UseBoundStore<zustand.StoreApi<SettingsStore>>;
|
|
263
|
+
declare const PROVIDER_INFO: Record<ProviderType, {
|
|
264
|
+
name: string;
|
|
265
|
+
description: string;
|
|
266
|
+
docsUrl: string;
|
|
267
|
+
}>;
|
|
7
268
|
|
|
8
269
|
type ModalType = 'templates' | 'cost' | 'welcome' | 'settings' | 'promptLibrary' | 'modelBrowser' | 'nodeDetail' | 'shortcutHelp' | 'nodeSearch' | null;
|
|
9
270
|
type NodeDetailTab = 'preview' | 'history';
|
|
@@ -106,387 +367,126 @@ interface ChatSlice {
|
|
|
106
367
|
skipped: string[];
|
|
107
368
|
};
|
|
108
369
|
}
|
|
109
|
-
|
|
110
|
-
interface ImageHistoryItem {
|
|
111
|
-
id: string;
|
|
112
|
-
image: string;
|
|
113
|
-
prompt?: string;
|
|
114
|
-
model?: string;
|
|
115
|
-
timestamp: number;
|
|
116
|
-
}
|
|
117
|
-
interface WorkflowData {
|
|
118
|
-
_id: string;
|
|
119
|
-
name: string;
|
|
120
|
-
nodes: WorkflowNode[];
|
|
121
|
-
edges: WorkflowEdge[];
|
|
122
|
-
edgeStyle: string;
|
|
123
|
-
groups?: NodeGroup[];
|
|
124
|
-
createdAt?: string;
|
|
125
|
-
updatedAt?: string;
|
|
126
|
-
}
|
|
127
|
-
interface WorkflowState {
|
|
128
|
-
nodes: WorkflowNode[];
|
|
129
|
-
edges: WorkflowEdge[];
|
|
130
|
-
edgeStyle: EdgeStyle;
|
|
131
|
-
workflowName: string;
|
|
132
|
-
workflowId: string | null;
|
|
133
|
-
isDirty: boolean;
|
|
134
|
-
isSaving: boolean;
|
|
135
|
-
isLoading: boolean;
|
|
136
|
-
groups: NodeGroup[];
|
|
137
|
-
selectedNodeIds: string[];
|
|
138
|
-
viewedCommentIds: Set<string>;
|
|
139
|
-
navigationTargetId: string | null;
|
|
140
|
-
globalImageHistory: ImageHistoryItem[];
|
|
141
|
-
}
|
|
142
|
-
interface NodeActions {
|
|
143
|
-
addNode: (type: NodeType, position: XYPosition) => string;
|
|
144
|
-
addNodesAndEdges: (nodes: WorkflowNode[], edges: WorkflowEdge[]) => void;
|
|
145
|
-
updateNodeData: <T extends WorkflowNodeData>(nodeId: string, data: Partial<T>) => void;
|
|
146
|
-
removeNode: (nodeId: string) => void;
|
|
147
|
-
duplicateNode: (nodeId: string) => string | null;
|
|
148
|
-
propagateOutputsDownstream: (sourceNodeId: string, outputValue?: string) => void;
|
|
149
|
-
}
|
|
150
|
-
interface ReactFlowActions {
|
|
151
|
-
onNodesChange: (changes: NodeChange<WorkflowNode>[]) => void;
|
|
152
|
-
onEdgesChange: (changes: EdgeChange<WorkflowEdge>[]) => void;
|
|
153
|
-
onConnect: (connection: Connection) => void;
|
|
154
|
-
}
|
|
155
|
-
interface EdgeActions {
|
|
156
|
-
removeEdge: (edgeId: string) => void;
|
|
157
|
-
setEdgeStyle: (style: EdgeStyle) => void;
|
|
158
|
-
toggleEdgePause: (edgeId: string) => void;
|
|
159
|
-
}
|
|
160
|
-
interface LockingActions {
|
|
161
|
-
_setNodeLockState: (predicate: (nodeId: string) => boolean, lock: boolean) => void;
|
|
162
|
-
toggleNodeLock: (nodeId: string) => void;
|
|
163
|
-
lockNode: (nodeId: string) => void;
|
|
164
|
-
unlockNode: (nodeId: string) => void;
|
|
165
|
-
lockMultipleNodes: (nodeIds: string[]) => void;
|
|
166
|
-
unlockMultipleNodes: (nodeIds: string[]) => void;
|
|
167
|
-
unlockAllNodes: () => void;
|
|
168
|
-
isNodeLocked: (nodeId: string) => boolean;
|
|
169
|
-
}
|
|
170
|
-
interface GroupActions {
|
|
171
|
-
createGroup: (nodeIds: string[], name?: string) => string;
|
|
172
|
-
deleteGroup: (groupId: string) => void;
|
|
173
|
-
addToGroup: (groupId: string, nodeIds: string[]) => void;
|
|
174
|
-
removeFromGroup: (groupId: string, nodeIds: string[]) => void;
|
|
175
|
-
toggleGroupLock: (groupId: string) => void;
|
|
176
|
-
renameGroup: (groupId: string, name: string) => void;
|
|
177
|
-
setGroupColor: (groupId: string, color: GroupColor) => void;
|
|
178
|
-
getGroupByNodeId: (nodeId: string) => NodeGroup | undefined;
|
|
179
|
-
getGroupById: (groupId: string) => NodeGroup | undefined;
|
|
180
|
-
}
|
|
181
|
-
interface SelectionActions {
|
|
182
|
-
setSelectedNodeIds: (nodeIds: string[]) => void;
|
|
183
|
-
addToSelection: (nodeId: string) => void;
|
|
184
|
-
removeFromSelection: (nodeId: string) => void;
|
|
185
|
-
clearSelection: () => void;
|
|
186
|
-
}
|
|
187
|
-
interface LocalWorkflowActions {
|
|
188
|
-
loadWorkflow: (workflow: WorkflowFile) => void;
|
|
189
|
-
clearWorkflow: () => void;
|
|
190
|
-
exportWorkflow: () => WorkflowFile;
|
|
191
|
-
}
|
|
192
|
-
interface ApiActions {
|
|
193
|
-
saveWorkflow: (signal?: AbortSignal) => Promise<WorkflowData>;
|
|
194
|
-
loadWorkflowById: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
195
|
-
listWorkflows: (signal?: AbortSignal) => Promise<WorkflowData[]>;
|
|
196
|
-
deleteWorkflow: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
197
|
-
duplicateWorkflowApi: (id: string, signal?: AbortSignal) => Promise<WorkflowData>;
|
|
198
|
-
createNewWorkflow: (signal?: AbortSignal) => Promise<string>;
|
|
199
|
-
setWorkflowName: (name: string) => void;
|
|
200
|
-
}
|
|
201
|
-
interface HelperActions$1 {
|
|
202
|
-
getNodeById: (id: string) => WorkflowNode | undefined;
|
|
203
|
-
getConnectedInputs: (nodeId: string) => Map<string, string | string[]>;
|
|
204
|
-
getConnectedNodeIds: (nodeIds: string[]) => string[];
|
|
205
|
-
validateWorkflow: () => ValidationResult;
|
|
206
|
-
isValidConnection: (connection: Connection) => boolean;
|
|
207
|
-
findCompatibleHandle: (sourceNodeId: string, sourceHandleId: string | null, targetNodeId: string) => string | null;
|
|
208
|
-
setDirty: (dirty: boolean) => void;
|
|
209
|
-
}
|
|
210
|
-
interface CommentNavigationActions {
|
|
211
|
-
getNodesWithComments: () => WorkflowNode[];
|
|
212
|
-
markCommentViewed: (nodeId: string) => void;
|
|
213
|
-
setNavigationTarget: (nodeId: string | null) => void;
|
|
214
|
-
getUnviewedCommentCount: () => number;
|
|
215
|
-
}
|
|
216
|
-
interface ImageHistoryActions {
|
|
217
|
-
addToGlobalHistory: (item: Omit<ImageHistoryItem, 'id'>) => void;
|
|
218
|
-
clearGlobalHistory: () => void;
|
|
219
|
-
}
|
|
220
|
-
interface WorkflowStore extends WorkflowState, NodeActions, ReactFlowActions, EdgeActions, LockingActions, GroupActions, SelectionActions, LocalWorkflowActions, ApiActions, HelperActions$1, CommentNavigationActions, ImageHistoryActions, SnapshotSlice, ChatSlice {
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
declare const useWorkflowStore: zustand.UseBoundStore<Omit<zustand.StoreApi<WorkflowStore>, "temporal"> & {
|
|
224
|
-
temporal: zustand.StoreApi<zundo.TemporalState<{
|
|
225
|
-
nodes: _genfeedai_types.WorkflowNode[];
|
|
226
|
-
edges: _genfeedai_types.WorkflowEdge[];
|
|
227
|
-
groups: _genfeedai_types.NodeGroup[];
|
|
228
|
-
}>>;
|
|
229
|
-
}>;
|
|
230
|
-
|
|
231
|
-
interface DebugPayload {
|
|
232
|
-
nodeId: string;
|
|
233
|
-
nodeName: string;
|
|
234
|
-
nodeType: string;
|
|
235
|
-
model: string;
|
|
236
|
-
input: Record<string, unknown>;
|
|
237
|
-
timestamp: string;
|
|
238
|
-
}
|
|
239
|
-
interface Job {
|
|
240
|
-
nodeId: string;
|
|
241
|
-
predictionId: string;
|
|
242
|
-
status: 'pending' | 'processing' | 'succeeded' | 'failed' | 'canceled';
|
|
243
|
-
progress: number;
|
|
244
|
-
output: unknown | null;
|
|
245
|
-
error: string | null;
|
|
246
|
-
createdAt: string;
|
|
247
|
-
}
|
|
248
|
-
interface NodeExecution {
|
|
249
|
-
executionId: string;
|
|
250
|
-
nodeIds: string[];
|
|
251
|
-
eventSource: EventSource;
|
|
252
|
-
}
|
|
253
|
-
interface ExecutionState {
|
|
254
|
-
isRunning: boolean;
|
|
255
|
-
executionId: string | null;
|
|
256
|
-
currentNodeId: string | null;
|
|
257
|
-
/** Node IDs being executed (for partial execution). Empty = all nodes */
|
|
258
|
-
executingNodeIds: string[];
|
|
259
|
-
validationErrors: ValidationResult | null;
|
|
260
|
-
eventSource: EventSource | null;
|
|
261
|
-
lastFailedNodeId: string | null;
|
|
262
|
-
pausedAtNodeId: string | null;
|
|
263
|
-
jobs: Map<string, Job>;
|
|
264
|
-
estimatedCost: number;
|
|
265
|
-
actualCost: number;
|
|
266
|
-
debugPayloads: DebugPayload[];
|
|
267
|
-
/** Independent per-node executions (Generate button clicks) */
|
|
268
|
-
activeNodeExecutions: Map<string, NodeExecution>;
|
|
269
|
-
}
|
|
270
|
-
interface ExecutionActions {
|
|
271
|
-
executeWorkflow: () => Promise<void>;
|
|
272
|
-
executeSelectedNodes: () => Promise<void>;
|
|
273
|
-
executeNode: (nodeId: string) => Promise<void>;
|
|
274
|
-
resumeFromFailed: () => Promise<void>;
|
|
275
|
-
stopExecution: () => void;
|
|
276
|
-
stopNodeExecution: (nodeId: string) => void;
|
|
277
|
-
isNodeExecuting: (nodeId: string) => boolean;
|
|
278
|
-
clearValidationErrors: () => void;
|
|
279
|
-
}
|
|
280
|
-
interface JobActions {
|
|
281
|
-
addJob: (nodeId: string, predictionId: string) => void;
|
|
282
|
-
updateJob: (predictionId: string, updates: Partial<Job>) => void;
|
|
283
|
-
getJobByNodeId: (nodeId: string) => Job | undefined;
|
|
284
|
-
}
|
|
285
|
-
interface HelperActions {
|
|
286
|
-
resetExecution: () => void;
|
|
287
|
-
canResumeFromFailed: () => boolean;
|
|
288
|
-
setEstimatedCost: (cost: number) => void;
|
|
289
|
-
addDebugPayload: (payload: DebugPayload) => void;
|
|
290
|
-
clearDebugPayloads: () => void;
|
|
291
|
-
}
|
|
292
|
-
interface ExecutionStore extends ExecutionState, ExecutionActions, JobActions, HelperActions {
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Execution Store
|
|
297
|
-
*
|
|
298
|
-
* Manages workflow execution state including jobs, validation, and SSE subscriptions.
|
|
299
|
-
* Split into slices for maintainability:
|
|
300
|
-
*
|
|
301
|
-
* - executionSlice: Core execution operations (run, stop, resume)
|
|
302
|
-
* - jobSlice: Job tracking and management
|
|
303
|
-
*/
|
|
304
|
-
declare const useExecutionStore: zustand.UseBoundStore<zustand.StoreApi<ExecutionStore>>;
|
|
305
|
-
|
|
306
|
-
interface ProviderConfig {
|
|
307
|
-
apiKey: string | null;
|
|
308
|
-
enabled: boolean;
|
|
309
|
-
}
|
|
310
|
-
interface ProviderSettings {
|
|
311
|
-
replicate: ProviderConfig;
|
|
312
|
-
fal: ProviderConfig;
|
|
313
|
-
huggingface: ProviderConfig;
|
|
314
|
-
'genfeed-ai': ProviderConfig;
|
|
315
|
-
}
|
|
316
|
-
interface DefaultModelSettings {
|
|
317
|
-
imageModel: string;
|
|
318
|
-
imageProvider: ProviderType;
|
|
319
|
-
videoModel: string;
|
|
320
|
-
videoProvider: ProviderType;
|
|
321
|
-
}
|
|
322
|
-
interface RecentModel {
|
|
370
|
+
|
|
371
|
+
interface ImageHistoryItem {
|
|
323
372
|
id: string;
|
|
324
|
-
|
|
325
|
-
|
|
373
|
+
image: string;
|
|
374
|
+
prompt?: string;
|
|
375
|
+
model?: string;
|
|
326
376
|
timestamp: number;
|
|
327
377
|
}
|
|
328
|
-
interface
|
|
329
|
-
|
|
330
|
-
|
|
378
|
+
interface WorkflowData {
|
|
379
|
+
_id: string;
|
|
380
|
+
name: string;
|
|
381
|
+
nodes: WorkflowNode[];
|
|
382
|
+
edges: WorkflowEdge[];
|
|
383
|
+
edgeStyle: string;
|
|
384
|
+
groups?: NodeGroup[];
|
|
385
|
+
createdAt?: string;
|
|
386
|
+
updatedAt?: string;
|
|
387
|
+
}
|
|
388
|
+
interface WorkflowState {
|
|
389
|
+
nodes: WorkflowNode[];
|
|
390
|
+
edges: WorkflowEdge[];
|
|
331
391
|
edgeStyle: EdgeStyle;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
392
|
+
workflowName: string;
|
|
393
|
+
workflowId: string | null;
|
|
394
|
+
isDirty: boolean;
|
|
395
|
+
isSaving: boolean;
|
|
396
|
+
isLoading: boolean;
|
|
397
|
+
groups: NodeGroup[];
|
|
398
|
+
selectedNodeIds: string[];
|
|
399
|
+
viewedCommentIds: Set<string>;
|
|
400
|
+
navigationTargetId: string | null;
|
|
401
|
+
globalImageHistory: ImageHistoryItem[];
|
|
402
|
+
}
|
|
403
|
+
interface NodeActions {
|
|
404
|
+
addNode: (type: NodeType, position: XYPosition) => string;
|
|
405
|
+
addNodesAndEdges: (nodes: WorkflowNode[], edges: WorkflowEdge[]) => void;
|
|
406
|
+
updateNodeData: <T extends WorkflowNodeData>(nodeId: string, data: Partial<T>) => void;
|
|
407
|
+
removeNode: (nodeId: string) => void;
|
|
408
|
+
duplicateNode: (nodeId: string) => string | null;
|
|
409
|
+
propagateOutputsDownstream: (sourceNodeId: string, outputValue?: string) => void;
|
|
410
|
+
}
|
|
411
|
+
interface ReactFlowActions {
|
|
412
|
+
onNodesChange: (changes: NodeChange<WorkflowNode>[]) => void;
|
|
413
|
+
onEdgesChange: (changes: EdgeChange<WorkflowEdge>[]) => void;
|
|
414
|
+
onConnect: (connection: Connection) => void;
|
|
415
|
+
}
|
|
416
|
+
interface EdgeActions {
|
|
417
|
+
removeEdge: (edgeId: string) => void;
|
|
342
418
|
setEdgeStyle: (style: EdgeStyle) => void;
|
|
343
|
-
|
|
344
|
-
addRecentModel: (model: Omit<RecentModel, 'timestamp'>) => void;
|
|
345
|
-
clearProviderKey: (provider: ProviderType) => void;
|
|
346
|
-
clearAllKeys: () => void;
|
|
347
|
-
setHasSeenWelcome: (seen: boolean) => void;
|
|
348
|
-
isProviderConfigured: (provider: ProviderType) => boolean;
|
|
349
|
-
getProviderHeader: (provider: ProviderType) => Record<string, string>;
|
|
350
|
-
isSyncing: boolean;
|
|
351
|
-
syncFromServer: () => Promise<void>;
|
|
352
|
-
syncToServer: () => Promise<void>;
|
|
419
|
+
toggleEdgePause: (edgeId: string) => void;
|
|
353
420
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
nodeId: string | null;
|
|
364
|
-
prompt: string;
|
|
365
|
-
fontSize: number;
|
|
366
|
-
openEditor: (nodeId: string, prompt: string) => void;
|
|
367
|
-
closeEditor: () => void;
|
|
368
|
-
setPrompt: (prompt: string) => void;
|
|
369
|
-
setFontSize: (size: number) => void;
|
|
370
|
-
saveAndClose: () => {
|
|
371
|
-
nodeId: string;
|
|
372
|
-
prompt: string;
|
|
373
|
-
} | null;
|
|
421
|
+
interface LockingActions {
|
|
422
|
+
_setNodeLockState: (predicate: (nodeId: string) => boolean, lock: boolean) => void;
|
|
423
|
+
toggleNodeLock: (nodeId: string) => void;
|
|
424
|
+
lockNode: (nodeId: string) => void;
|
|
425
|
+
unlockNode: (nodeId: string) => void;
|
|
426
|
+
lockMultipleNodes: (nodeIds: string[]) => void;
|
|
427
|
+
unlockMultipleNodes: (nodeIds: string[]) => void;
|
|
428
|
+
unlockAllNodes: () => void;
|
|
429
|
+
isNodeLocked: (nodeId: string) => boolean;
|
|
374
430
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
431
|
+
interface GroupActions {
|
|
432
|
+
createGroup: (nodeIds: string[], name?: string) => string;
|
|
433
|
+
deleteGroup: (groupId: string) => void;
|
|
434
|
+
addToGroup: (groupId: string, nodeIds: string[]) => void;
|
|
435
|
+
removeFromGroup: (groupId: string, nodeIds: string[]) => void;
|
|
436
|
+
toggleGroupLock: (groupId: string) => void;
|
|
437
|
+
renameGroup: (groupId: string, name: string) => void;
|
|
438
|
+
setGroupColor: (groupId: string, color: GroupColor) => void;
|
|
439
|
+
getGroupByNodeId: (nodeId: string) => NodeGroup | undefined;
|
|
440
|
+
getGroupById: (groupId: string) => NodeGroup | undefined;
|
|
383
441
|
}
|
|
384
|
-
interface
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
fillColor: string | null;
|
|
442
|
+
interface SelectionActions {
|
|
443
|
+
setSelectedNodeIds: (nodeIds: string[]) => void;
|
|
444
|
+
addToSelection: (nodeId: string) => void;
|
|
445
|
+
removeFromSelection: (nodeId: string) => void;
|
|
446
|
+
clearSelection: () => void;
|
|
390
447
|
}
|
|
391
|
-
interface
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
width: number;
|
|
396
|
-
height: number;
|
|
448
|
+
interface LocalWorkflowActions {
|
|
449
|
+
loadWorkflow: (workflow: WorkflowFile) => void;
|
|
450
|
+
clearWorkflow: () => void;
|
|
451
|
+
exportWorkflow: () => WorkflowFile;
|
|
397
452
|
}
|
|
398
|
-
interface
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
453
|
+
interface ApiActions {
|
|
454
|
+
saveWorkflow: (signal?: AbortSignal) => Promise<WorkflowData>;
|
|
455
|
+
loadWorkflowById: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
456
|
+
listWorkflows: (signal?: AbortSignal) => Promise<WorkflowData[]>;
|
|
457
|
+
deleteWorkflow: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
458
|
+
duplicateWorkflowApi: (id: string, signal?: AbortSignal) => Promise<WorkflowData>;
|
|
459
|
+
createNewWorkflow: (signal?: AbortSignal) => Promise<string>;
|
|
460
|
+
setWorkflowName: (name: string) => void;
|
|
403
461
|
}
|
|
404
|
-
interface
|
|
405
|
-
|
|
406
|
-
|
|
462
|
+
interface HelperActions {
|
|
463
|
+
getNodeById: (id: string) => WorkflowNode | undefined;
|
|
464
|
+
getConnectedInputs: (nodeId: string) => Map<string, string | string[]>;
|
|
465
|
+
getConnectedNodeIds: (nodeIds: string[]) => string[];
|
|
466
|
+
validateWorkflow: () => ValidationResult;
|
|
467
|
+
isValidConnection: (connection: Connection) => boolean;
|
|
468
|
+
findCompatibleHandle: (sourceNodeId: string, sourceHandleId: string | null, targetNodeId: string) => string | null;
|
|
469
|
+
setDirty: (dirty: boolean) => void;
|
|
407
470
|
}
|
|
408
|
-
interface
|
|
409
|
-
|
|
410
|
-
|
|
471
|
+
interface CommentNavigationActions {
|
|
472
|
+
getNodesWithComments: () => WorkflowNode[];
|
|
473
|
+
markCommentViewed: (nodeId: string) => void;
|
|
474
|
+
setNavigationTarget: (nodeId: string | null) => void;
|
|
475
|
+
getUnviewedCommentCount: () => number;
|
|
411
476
|
}
|
|
412
|
-
interface
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
y: number;
|
|
416
|
-
text: string;
|
|
417
|
-
fontSize: number;
|
|
477
|
+
interface ImageHistoryActions {
|
|
478
|
+
addToGlobalHistory: (item: Omit<ImageHistoryItem, 'id'>) => void;
|
|
479
|
+
clearGlobalHistory: () => void;
|
|
418
480
|
}
|
|
419
|
-
|
|
420
|
-
interface AnnotationStore {
|
|
421
|
-
isOpen: boolean;
|
|
422
|
-
nodeId: string | null;
|
|
423
|
-
sourceImage: string | null;
|
|
424
|
-
shapes: AnnotationShape[];
|
|
425
|
-
selectedShapeId: string | null;
|
|
426
|
-
currentTool: AnnotationTool;
|
|
427
|
-
toolOptions: ToolOptions;
|
|
428
|
-
history: AnnotationShape[][];
|
|
429
|
-
historyIndex: number;
|
|
430
|
-
isDrawing: boolean;
|
|
431
|
-
drawingShape: Partial<AnnotationShape> | null;
|
|
432
|
-
openAnnotation: (nodeId: string, image: string, existingShapes?: AnnotationShape[]) => void;
|
|
433
|
-
closeAnnotation: () => void;
|
|
434
|
-
saveAndClose: () => {
|
|
435
|
-
nodeId: string;
|
|
436
|
-
shapes: AnnotationShape[];
|
|
437
|
-
} | null;
|
|
438
|
-
addShape: (shape: AnnotationShape) => void;
|
|
439
|
-
updateShape: (id: string, updates: Partial<AnnotationShape>) => void;
|
|
440
|
-
deleteShape: (id: string) => void;
|
|
441
|
-
selectShape: (id: string | null) => void;
|
|
442
|
-
clearShapes: () => void;
|
|
443
|
-
setTool: (tool: AnnotationTool) => void;
|
|
444
|
-
setToolOptions: (options: Partial<ToolOptions>) => void;
|
|
445
|
-
startDrawing: (shape: Partial<AnnotationShape>) => void;
|
|
446
|
-
updateDrawing: (updates: Partial<AnnotationShape>) => void;
|
|
447
|
-
finishDrawing: () => void;
|
|
448
|
-
cancelDrawing: () => void;
|
|
449
|
-
undo: () => void;
|
|
450
|
-
redo: () => void;
|
|
451
|
-
canUndo: () => boolean;
|
|
452
|
-
canRedo: () => boolean;
|
|
481
|
+
interface WorkflowStore extends WorkflowState, NodeActions, ReactFlowActions, EdgeActions, LockingActions, GroupActions, SelectionActions, LocalWorkflowActions, ApiActions, HelperActions, CommentNavigationActions, ImageHistoryActions, SnapshotSlice, ChatSlice {
|
|
453
482
|
}
|
|
454
|
-
declare const useAnnotationStore: zustand.UseBoundStore<zustand.StoreApi<AnnotationStore>>;
|
|
455
483
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
declare function configurePromptLibrary(api: PromptLibraryService): void;
|
|
464
|
-
interface PromptLibraryStore {
|
|
465
|
-
items: IPrompt[];
|
|
466
|
-
featuredItems: IPrompt[];
|
|
467
|
-
selectedItem: IPrompt | null;
|
|
468
|
-
isLoading: boolean;
|
|
469
|
-
error: string | null;
|
|
470
|
-
searchQuery: string;
|
|
471
|
-
categoryFilter: PromptCategory | null;
|
|
472
|
-
isPickerOpen: boolean;
|
|
473
|
-
isCreateModalOpen: boolean;
|
|
474
|
-
editingItem: IPrompt | null;
|
|
475
|
-
setSearchQuery: (query: string) => void;
|
|
476
|
-
setCategoryFilter: (category: PromptCategory | null) => void;
|
|
477
|
-
setSelectedItem: (item: IPrompt | null) => void;
|
|
478
|
-
openPicker: () => void;
|
|
479
|
-
closePicker: () => void;
|
|
480
|
-
openCreateModal: (editItem?: IPrompt) => void;
|
|
481
|
-
closeCreateModal: () => void;
|
|
482
|
-
loadItems: (query?: IQueryPrompts, signal?: AbortSignal) => Promise<void>;
|
|
483
|
-
loadFeatured: (signal?: AbortSignal) => Promise<void>;
|
|
484
|
-
createItem: (data: ICreatePrompt, signal?: AbortSignal) => Promise<IPrompt>;
|
|
485
|
-
updateItem: (id: string, data: Partial<ICreatePrompt>, signal?: AbortSignal) => Promise<IPrompt>;
|
|
486
|
-
deleteItem: (id: string, signal?: AbortSignal) => Promise<void>;
|
|
487
|
-
duplicateItem: (id: string, signal?: AbortSignal) => Promise<IPrompt>;
|
|
488
|
-
recordItemUsage: (id: string, signal?: AbortSignal) => Promise<IPrompt>;
|
|
489
|
-
}
|
|
490
|
-
declare const usePromptLibraryStore: zustand.UseBoundStore<zustand.StoreApi<PromptLibraryStore>>;
|
|
484
|
+
declare const useWorkflowStore: zustand.UseBoundStore<Omit<zustand.StoreApi<WorkflowStore>, "temporal"> & {
|
|
485
|
+
temporal: zustand.StoreApi<zundo.TemporalState<{
|
|
486
|
+
edges: _genfeedai_types.WorkflowEdge[];
|
|
487
|
+
groups: _genfeedai_types.NodeGroup[];
|
|
488
|
+
nodes: _genfeedai_types.WorkflowNode[];
|
|
489
|
+
}>>;
|
|
490
|
+
}>;
|
|
491
491
|
|
|
492
492
|
export { type AnnotationShape as A, type BaseShape as B, type CircleShape as C, type DebugPayload as D, type ExecutionStore as E, type FreehandShape as F, type ImageHistoryItem as I, type Job as J, type ModalType as M, type NodeDetailTab as N, PROVIDER_INFO as P, type RecentModel as R, type TextShape as T, type WorkflowStore as W, type AnnotationTool as a, type ArrowShape as b, type DefaultModelSettings as c, type ProviderConfig as d, type ProviderSettings as e, type RectangleShape as f, type ToolOptions as g, type WorkflowData as h, type WorkflowState as i, configurePromptLibrary as j, useExecutionStore as k, usePromptEditorStore as l, usePromptLibraryStore as m, useSettingsStore as n, useUIStore as o, useWorkflowStore as p, useAnnotationStore as u };
|