@flowdrop/flowdrop 1.14.0 → 2.0.0-beta.1
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/CHANGELOG.md +475 -0
- package/MIGRATION-2.0.md +472 -0
- package/README.md +23 -23
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +14 -8
- package/dist/adapters/agentspec/AgentSpecAdapter.js +7 -7
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +15 -1
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +26 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/App.svelte +162 -192
- package/dist/components/App.svelte.d.ts +47 -8
- package/dist/components/ConfigForm.svelte +110 -66
- package/dist/components/ConfigModal.svelte +7 -2
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/Navbar.svelte +61 -1
- package/dist/components/NodeSidebar.svelte +27 -45
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +10 -8
- package/dist/components/PipelineStatus.svelte +16 -67
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +45 -40
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/SettingsModal.svelte +8 -3
- package/dist/components/SettingsPanel.svelte +20 -4
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/UniversalNode.svelte +9 -7
- package/dist/components/WorkflowEditor.svelte +118 -111
- package/dist/components/WorkflowEditor.svelte.d.ts +18 -10
- package/dist/components/chat/AIChatPanel.svelte +93 -89
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +15 -6
- package/dist/components/console/ConsoleOutput.svelte +2 -1
- package/dist/components/form/FormArray.svelte +5 -9
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +29 -13
- package/dist/components/form/FormField.svelte +4 -2
- package/dist/components/form/FormFieldLight.svelte +4 -2
- package/dist/components/form/FormMarkdownEditor.svelte +9 -4
- package/dist/components/form/FormRangeField.svelte +1 -0
- package/dist/components/form/FormTemplateEditor.svelte +11 -3
- package/dist/components/form/FormToggle.svelte +5 -12
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +16 -17
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
- package/dist/components/layouts/MainLayout.svelte +20 -13
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +292 -0
- package/dist/components/nodes/AtomNode.svelte.d.ts +26 -0
- package/dist/components/nodes/GatewayNode.svelte +19 -10
- package/dist/components/nodes/IdeaNode.svelte +7 -0
- package/dist/components/nodes/SimpleNode.svelte +11 -6
- package/dist/components/nodes/SquareNode.svelte +15 -8
- package/dist/components/nodes/TerminalNode.svelte +9 -4
- package/dist/components/nodes/ToolNode.svelte +7 -1
- package/dist/components/nodes/WorkflowNode.svelte +16 -7
- package/dist/components/playground/ChatInput.svelte +11 -14
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +11 -9
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +65 -6
- package/dist/components/playground/PipelinePanel.svelte +11 -5
- package/dist/components/playground/PipelineTableView.svelte +186 -44
- package/dist/components/playground/Playground.svelte +95 -92
- package/dist/components/playground/Playground.svelte.d.ts +2 -0
- package/dist/components/playground/PlaygroundApp.svelte +6 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundModal.svelte +13 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundStudio.svelte +34 -32
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +28 -0
- package/dist/components/playground/pipelineViewUtils.svelte.js +38 -1
- package/dist/config/endpoints.d.ts +0 -7
- package/dist/config/endpoints.js +2 -10
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +6 -6
- package/dist/display/index.d.ts +0 -2
- package/dist/display/index.js +0 -6
- package/dist/editor/index.d.ts +19 -20
- package/dist/editor/index.js +25 -35
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +17 -13
- package/dist/form/full.js +22 -27
- package/dist/form/index.d.ts +3 -3
- package/dist/form/index.js +3 -3
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +7 -3
- package/dist/helpers/proximityConnect.js +19 -6
- package/dist/helpers/workflowEditorHelper.d.ts +12 -5
- package/dist/helpers/workflowEditorHelper.js +27 -25
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +0 -1
- package/dist/messages/index.js +0 -1
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +227 -164
- package/dist/playground/index.d.ts +2 -3
- package/dist/playground/index.js +2 -30
- package/dist/playground/mount.d.ts +15 -0
- package/dist/playground/mount.js +46 -20
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodes.d.ts +1 -26
- package/dist/registry/builtinNodes.js +14 -50
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +182 -15
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +53 -6
- package/dist/services/agentSpecExecutionService.js +0 -1
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +5 -22
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/chatService.d.ts +8 -4
- package/dist/services/chatService.js +15 -15
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +2 -1
- package/dist/services/dynamicSchemaService.js +5 -22
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +9 -3
- package/dist/services/historyService.js +9 -3
- package/dist/services/interruptService.d.ts +14 -9
- package/dist/services/interruptService.js +27 -27
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +14 -9
- package/dist/services/playgroundService.js +31 -30
- package/dist/services/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/stores/apiContext.d.ts +45 -0
- package/dist/stores/apiContext.js +65 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +70 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +77 -93
- package/dist/stores/historyStore.svelte.js +134 -160
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +114 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -216
- package/dist/stores/playgroundStore.svelte.js +515 -572
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +4 -1
- package/dist/stores/settingsStore.svelte.js +47 -12
- package/dist/stores/workflowStore.svelte.d.ts +178 -213
- package/dist/stores/workflowStore.svelte.js +449 -501
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/svelte-app.d.ts +60 -10
- package/dist/svelte-app.js +157 -53
- package/dist/types/events.d.ts +6 -3
- package/dist/types/index.d.ts +71 -6
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +13 -0
- package/dist/types/settings.js +1 -0
- package/dist/utils/colors.d.ts +47 -21
- package/dist/utils/colors.js +69 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +13 -32
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- package/dist/utils/formMerge.d.ts +36 -0
- package/dist/utils/formMerge.js +70 -0
- package/dist/utils/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -126
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -19
- package/dist/utils/performanceUtils.js +7 -0
- package/package.json +6 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
package/dist/services/api.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side API service for FlowDrop
|
|
3
|
-
* Provides methods to interact with the backend APIs using configurable endpoints
|
|
4
|
-
*/
|
|
5
|
-
import { buildEndpointUrl, getEndpointMethod, getEndpointHeaders } from '../config/endpoints.js';
|
|
6
|
-
let endpointConfig = null;
|
|
7
|
-
/**
|
|
8
|
-
* Set the endpoint configuration at runtime
|
|
9
|
-
*/
|
|
10
|
-
export function setEndpointConfig(config) {
|
|
11
|
-
endpointConfig = config;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Get the current endpoint configuration
|
|
15
|
-
*/
|
|
16
|
-
export function getEndpointConfig() {
|
|
17
|
-
return endpointConfig;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Generic API request helper with endpoint configuration
|
|
21
|
-
*/
|
|
22
|
-
async function apiRequest(endpointKey, endpointPath, params, options = {}) {
|
|
23
|
-
if (!endpointConfig) {
|
|
24
|
-
throw new Error('Endpoint configuration not set. Call setEndpointConfig() first.');
|
|
25
|
-
}
|
|
26
|
-
const url = buildEndpointUrl(endpointConfig, endpointPath, params);
|
|
27
|
-
const method = getEndpointMethod(endpointConfig, endpointKey);
|
|
28
|
-
const headers = getEndpointHeaders(endpointConfig, endpointKey);
|
|
29
|
-
const response = await fetch(url, {
|
|
30
|
-
method,
|
|
31
|
-
headers,
|
|
32
|
-
...options
|
|
33
|
-
});
|
|
34
|
-
// Check if response is JSON
|
|
35
|
-
const contentType = response.headers.get('content-type');
|
|
36
|
-
const isJson = contentType?.includes('application/json');
|
|
37
|
-
if (!response.ok) {
|
|
38
|
-
// Try to get error details
|
|
39
|
-
let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
40
|
-
if (isJson) {
|
|
41
|
-
try {
|
|
42
|
-
const data = await response.json();
|
|
43
|
-
errorMessage = data.error || data.message || errorMessage;
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// Failed to parse JSON, use default error message
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
// Response is not JSON (probably HTML error page)
|
|
51
|
-
try {
|
|
52
|
-
const text = await response.text();
|
|
53
|
-
// Extract first 200 characters for debugging
|
|
54
|
-
const preview = text.substring(0, 200).trim();
|
|
55
|
-
errorMessage = `${errorMessage}. Server returned: ${preview}...`;
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
// Failed to read response text
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
throw new Error(errorMessage);
|
|
62
|
-
}
|
|
63
|
-
// Parse successful response
|
|
64
|
-
const data = await response.json();
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Node API methods
|
|
69
|
-
*/
|
|
70
|
-
export const nodeApi = {
|
|
71
|
-
/**
|
|
72
|
-
* Get all node types with optional filtering
|
|
73
|
-
*/
|
|
74
|
-
async getNodes(options) {
|
|
75
|
-
if (!endpointConfig) {
|
|
76
|
-
throw new Error('Endpoint configuration not set');
|
|
77
|
-
}
|
|
78
|
-
const params = new URLSearchParams();
|
|
79
|
-
if (options?.category)
|
|
80
|
-
params.append('category', options.category);
|
|
81
|
-
if (options?.search)
|
|
82
|
-
params.append('search', options.search);
|
|
83
|
-
if (options?.limit)
|
|
84
|
-
params.append('limit', options.limit.toString());
|
|
85
|
-
if (options?.offset)
|
|
86
|
-
params.append('offset', options.offset.toString());
|
|
87
|
-
const response = await apiRequest('nodes.list', endpointConfig.endpoints.nodes.list + '?' + params.toString());
|
|
88
|
-
return response.data || [];
|
|
89
|
-
},
|
|
90
|
-
/**
|
|
91
|
-
* Get a specific node type by ID
|
|
92
|
-
*/
|
|
93
|
-
async getNode(id) {
|
|
94
|
-
if (!endpointConfig) {
|
|
95
|
-
throw new Error('Endpoint configuration not set');
|
|
96
|
-
}
|
|
97
|
-
const response = await apiRequest('nodes.get', endpointConfig.endpoints.nodes.get, { id });
|
|
98
|
-
if (!response.data) {
|
|
99
|
-
throw new Error('Node not found');
|
|
100
|
-
}
|
|
101
|
-
return response.data;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Workflow API methods
|
|
106
|
-
*/
|
|
107
|
-
export const workflowApi = {
|
|
108
|
-
/**
|
|
109
|
-
* Get all workflows with optional filtering
|
|
110
|
-
*/
|
|
111
|
-
async getWorkflows(options) {
|
|
112
|
-
if (!endpointConfig) {
|
|
113
|
-
throw new Error('Endpoint configuration not set');
|
|
114
|
-
}
|
|
115
|
-
const params = new URLSearchParams();
|
|
116
|
-
if (options?.search)
|
|
117
|
-
params.append('search', options.search);
|
|
118
|
-
if (options?.limit)
|
|
119
|
-
params.append('limit', options.limit.toString());
|
|
120
|
-
if (options?.offset)
|
|
121
|
-
params.append('offset', options.offset.toString());
|
|
122
|
-
const response = await apiRequest('workflows.list', endpointConfig.endpoints.workflows.list + '?' + params.toString());
|
|
123
|
-
return response.data || [];
|
|
124
|
-
},
|
|
125
|
-
/**
|
|
126
|
-
* Get a specific workflow by ID
|
|
127
|
-
*/
|
|
128
|
-
async getWorkflow(id) {
|
|
129
|
-
if (!endpointConfig) {
|
|
130
|
-
throw new Error('Endpoint configuration not set');
|
|
131
|
-
}
|
|
132
|
-
const response = await apiRequest('workflows.get', endpointConfig.endpoints.workflows.get, { id });
|
|
133
|
-
if (!response.data) {
|
|
134
|
-
throw new Error('Workflow not found');
|
|
135
|
-
}
|
|
136
|
-
return response.data;
|
|
137
|
-
},
|
|
138
|
-
/**
|
|
139
|
-
* Create a new workflow
|
|
140
|
-
*/
|
|
141
|
-
async createWorkflow(workflow) {
|
|
142
|
-
if (!endpointConfig) {
|
|
143
|
-
throw new Error('Endpoint configuration not set');
|
|
144
|
-
}
|
|
145
|
-
// Apply the consumer-provided payload transform (e.g. Drupal's label mapping).
|
|
146
|
-
// The default is the identity function — no CMS-specific logic in the core library.
|
|
147
|
-
const transform = endpointConfig.transformWorkflowPayload ?? ((w) => w);
|
|
148
|
-
const body = transform(workflow);
|
|
149
|
-
const response = await apiRequest('workflows.create', endpointConfig.endpoints.workflows.create, undefined, {
|
|
150
|
-
method: 'POST',
|
|
151
|
-
body: JSON.stringify(body)
|
|
152
|
-
});
|
|
153
|
-
if (!response.data) {
|
|
154
|
-
throw new Error('Failed to create workflow');
|
|
155
|
-
}
|
|
156
|
-
return response.data;
|
|
157
|
-
},
|
|
158
|
-
/**
|
|
159
|
-
* Update an existing workflow
|
|
160
|
-
*/
|
|
161
|
-
async updateWorkflow(id, workflow) {
|
|
162
|
-
if (!endpointConfig) {
|
|
163
|
-
throw new Error('Endpoint configuration not set');
|
|
164
|
-
}
|
|
165
|
-
// Apply the consumer-provided payload transform (e.g. Drupal's label mapping).
|
|
166
|
-
// The default is the identity function — no CMS-specific logic in the core library.
|
|
167
|
-
const transform = endpointConfig.transformWorkflowPayload ?? ((w) => w);
|
|
168
|
-
const body = transform(workflow);
|
|
169
|
-
const response = await apiRequest('workflows.update', endpointConfig.endpoints.workflows.update, { id }, {
|
|
170
|
-
method: 'PUT',
|
|
171
|
-
body: JSON.stringify(body)
|
|
172
|
-
});
|
|
173
|
-
if (!response.data) {
|
|
174
|
-
throw new Error('Failed to update workflow');
|
|
175
|
-
}
|
|
176
|
-
return response.data;
|
|
177
|
-
},
|
|
178
|
-
/**
|
|
179
|
-
* Delete a workflow
|
|
180
|
-
*/
|
|
181
|
-
async deleteWorkflow(id) {
|
|
182
|
-
if (!endpointConfig) {
|
|
183
|
-
throw new Error('Endpoint configuration not set');
|
|
184
|
-
}
|
|
185
|
-
await apiRequest('workflows.delete', endpointConfig.endpoints.workflows.delete, { id }, { method: 'DELETE' });
|
|
186
|
-
},
|
|
187
|
-
/**
|
|
188
|
-
* Save workflow (create or update).
|
|
189
|
-
*
|
|
190
|
-
* A workflow is considered existing when it already has an id (any format —
|
|
191
|
-
* integer, UUID, slug). Only a missing/empty id means "truly new".
|
|
192
|
-
*
|
|
193
|
-
* Note: globalSave.ts bypasses this method and calls createWorkflow /
|
|
194
|
-
* updateWorkflow directly so it can capture the new/existing decision before
|
|
195
|
-
* the uuidv4() fallback. This method is kept for external callers.
|
|
196
|
-
*/
|
|
197
|
-
async saveWorkflow(workflow) {
|
|
198
|
-
const isExistingWorkflow = !!(workflow.id && workflow.id.length > 0);
|
|
199
|
-
if (isExistingWorkflow) {
|
|
200
|
-
// Update existing workflow
|
|
201
|
-
return this.updateWorkflow(workflow.id, workflow);
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
// Create new workflow
|
|
205
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
206
|
-
const { id, ...workflowData } = workflow;
|
|
207
|
-
return this.createWorkflow(workflowData);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Export the API service
|
|
213
|
-
*/
|
|
214
|
-
export const api = {
|
|
215
|
-
nodes: nodeApi,
|
|
216
|
-
workflows: workflowApi
|
|
217
|
-
};
|