@d34dman/flowdrop 0.0.1 → 0.0.2
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 +307 -215
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +30 -30
- package/dist/api/client.d.ts +24 -1
- package/dist/api/client.js +55 -38
- package/dist/api/enhanced-client.d.ts +46 -0
- package/dist/api/enhanced-client.js +211 -0
- package/dist/clients/ApiClient.d.ts +19 -23
- package/dist/clients/ApiClient.js +36 -34
- package/dist/components/App.svelte +1299 -230
- package/dist/components/App.svelte.d.ts +21 -1
- package/dist/components/CanvasBanner.svelte +50 -44
- package/dist/components/CanvasBanner.svelte.d.ts +5 -19
- package/dist/components/ConfigForm.svelte +555 -0
- package/dist/components/ConfigForm.svelte.d.ts +32 -0
- package/dist/components/ConfigModal.svelte +261 -0
- package/dist/components/ConfigModal.svelte.d.ts +31 -0
- package/dist/components/ConfigSidebar.svelte +934 -0
- package/dist/components/ConfigSidebar.svelte.d.ts +51 -0
- package/dist/components/ConnectionLine.svelte +32 -0
- package/dist/components/ConnectionLine.svelte.d.ts +3 -0
- package/dist/components/GatewayNode.svelte +471 -0
- package/dist/components/GatewayNode.svelte.d.ts +15 -0
- package/dist/components/LoadingSpinner.svelte +23 -23
- package/dist/components/LoadingSpinner.svelte.d.ts +1 -1
- package/dist/components/Logo.svelte +82 -0
- package/dist/components/Logo.svelte.d.ts +26 -0
- package/dist/components/LogsSidebar.svelte +565 -0
- package/dist/components/LogsSidebar.svelte.d.ts +34 -0
- package/dist/components/MarkdownDisplay.svelte +28 -0
- package/dist/components/MarkdownDisplay.svelte.d.ts +7 -0
- package/dist/components/Navbar.svelte +663 -0
- package/dist/components/Navbar.svelte.d.ts +21 -0
- package/dist/components/NodeSidebar.svelte +629 -488
- package/dist/components/NodeSidebar.svelte.d.ts +1 -2
- package/dist/components/NodeStatusOverlay.svelte +327 -0
- package/dist/components/NodeStatusOverlay.svelte.d.ts +11 -0
- package/dist/components/NotesNode.svelte +566 -0
- package/dist/components/NotesNode.svelte.d.ts +43 -0
- package/dist/components/PipelineStatus.svelte +331 -0
- package/dist/components/PipelineStatus.svelte.d.ts +18 -0
- package/dist/components/SimpleNode.svelte +447 -0
- package/dist/components/SimpleNode.svelte.d.ts +24 -0
- package/dist/components/SquareNode.svelte +346 -0
- package/dist/components/SquareNode.svelte.d.ts +24 -0
- package/dist/components/StatusIcon.svelte +112 -0
- package/dist/components/StatusIcon.svelte.d.ts +10 -0
- package/dist/components/StatusLabel.svelte +33 -0
- package/dist/components/StatusLabel.svelte.d.ts +7 -0
- package/dist/components/ToolNode.svelte +385 -0
- package/dist/components/ToolNode.svelte.d.ts +36 -0
- package/dist/components/UniversalNode.svelte +126 -0
- package/dist/components/UniversalNode.svelte.d.ts +15 -0
- package/dist/components/WorkflowEditor.svelte +871 -528
- package/dist/components/WorkflowEditor.svelte.d.ts +15 -5
- package/dist/components/WorkflowNode.svelte +428 -542
- package/dist/components/WorkflowNode.svelte.d.ts +7 -3
- package/dist/config/apiConfig.d.ts +33 -0
- package/dist/config/apiConfig.js +39 -0
- package/dist/config/defaultPortConfig.d.ts +6 -0
- package/dist/config/defaultPortConfig.js +192 -0
- package/dist/config/demo.d.ts +58 -0
- package/dist/config/demo.js +142 -0
- package/dist/config/endpoints.d.ts +106 -0
- package/dist/config/endpoints.js +128 -0
- package/dist/data/samples.d.ts +38 -4
- package/dist/data/samples.js +2789 -737
- package/dist/examples/adapter-usage.d.ts +4 -4
- package/dist/examples/adapter-usage.js +21 -26
- package/dist/examples/api-client-usage.d.ts +6 -6
- package/dist/examples/api-client-usage.js +55 -54
- package/dist/index.d.ts +23 -15
- package/dist/index.js +23 -15
- package/dist/mocks/app-environment.d.ts +8 -0
- package/dist/mocks/app-environment.js +16 -0
- package/dist/mocks/app-forms.d.ts +2 -0
- package/dist/mocks/app-forms.js +21 -0
- package/dist/mocks/app-navigation.d.ts +5 -0
- package/dist/mocks/app-navigation.js +34 -0
- package/dist/mocks/app-stores.d.ts +14 -0
- package/dist/mocks/app-stores.js +26 -0
- package/dist/services/api.d.ts +13 -3
- package/dist/services/api.js +91 -36
- package/dist/services/globalSave.d.ts +20 -0
- package/dist/services/globalSave.js +165 -0
- package/dist/services/nodeExecutionService.d.ts +63 -0
- package/dist/services/nodeExecutionService.js +261 -0
- package/dist/services/portConfigApi.d.ts +14 -0
- package/dist/services/portConfigApi.js +69 -0
- package/dist/services/toastService.d.ts +147 -0
- package/dist/services/toastService.js +235 -0
- package/dist/services/workflowStorage.d.ts +2 -2
- package/dist/services/workflowStorage.js +10 -10
- package/dist/stores/workflowStore.d.ts +53 -0
- package/dist/stores/workflowStore.js +264 -0
- package/dist/styles/base.css +896 -363
- package/dist/svelte-app.d.ts +52 -5
- package/dist/svelte-app.js +128 -6
- package/dist/types/config.d.ts +291 -0
- package/dist/types/config.js +4 -0
- package/dist/types/index.d.ts +231 -19
- package/dist/types/index.js +1 -1
- package/dist/utils/colors.d.ts +67 -33
- package/dist/utils/colors.js +183 -118
- package/dist/utils/config.d.ts +41 -0
- package/dist/utils/config.js +248 -0
- package/dist/utils/connections.d.ts +40 -3
- package/dist/utils/connections.js +115 -44
- package/dist/utils/icons.d.ts +1 -1
- package/dist/utils/icons.js +71 -70
- package/dist/utils/nodeStatus.d.ts +53 -0
- package/dist/utils/nodeStatus.js +183 -0
- package/dist/utils/nodeTypes.d.ts +57 -0
- package/dist/utils/nodeTypes.js +109 -0
- package/dist/utils/nodeWrapper.d.ts +39 -0
- package/dist/utils/nodeWrapper.js +62 -0
- package/package.json +129 -97
- package/dist/components/Node.svelte +0 -38
- package/dist/components/Node.svelte.d.ts +0 -4
package/dist/utils/icons.js
CHANGED
|
@@ -7,93 +7,94 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export const DEFAULT_ICONS = {
|
|
9
9
|
// Node fallback icons
|
|
10
|
-
NODE:
|
|
11
|
-
CATEGORY:
|
|
10
|
+
NODE: 'mdi:cube',
|
|
11
|
+
CATEGORY: 'mdi:folder',
|
|
12
12
|
// UI action icons
|
|
13
|
-
ADD:
|
|
14
|
-
REMOVE:
|
|
15
|
-
EDIT:
|
|
16
|
-
SAVE:
|
|
17
|
-
LOAD:
|
|
18
|
-
EXPORT:
|
|
19
|
-
IMPORT:
|
|
20
|
-
SEARCH:
|
|
21
|
-
CLOSE:
|
|
22
|
-
SETTINGS:
|
|
23
|
-
HELP:
|
|
13
|
+
ADD: 'mdi:plus',
|
|
14
|
+
REMOVE: 'mdi:minus',
|
|
15
|
+
EDIT: 'mdi:pencil',
|
|
16
|
+
SAVE: 'mdi:content-save',
|
|
17
|
+
LOAD: 'mdi:folder-open',
|
|
18
|
+
EXPORT: 'mdi:download',
|
|
19
|
+
IMPORT: 'mdi:upload',
|
|
20
|
+
SEARCH: 'mdi:magnify',
|
|
21
|
+
CLOSE: 'mdi:close',
|
|
22
|
+
SETTINGS: 'mdi:cog',
|
|
23
|
+
HELP: 'mdi:help-circle',
|
|
24
24
|
// Status icons
|
|
25
|
-
SUCCESS:
|
|
26
|
-
ERROR:
|
|
27
|
-
WARNING:
|
|
28
|
-
INFO:
|
|
29
|
-
LOADING:
|
|
25
|
+
SUCCESS: 'mdi:check-circle',
|
|
26
|
+
ERROR: 'mdi:alert-circle',
|
|
27
|
+
WARNING: 'mdi:alert',
|
|
28
|
+
INFO: 'mdi:information',
|
|
29
|
+
LOADING: 'mdi:loading',
|
|
30
30
|
// Navigation icons
|
|
31
|
-
HOME:
|
|
32
|
-
BACK:
|
|
33
|
-
FORWARD:
|
|
34
|
-
UP:
|
|
35
|
-
DOWN:
|
|
31
|
+
HOME: 'mdi:home',
|
|
32
|
+
BACK: 'mdi:arrow-left',
|
|
33
|
+
FORWARD: 'mdi:arrow-right',
|
|
34
|
+
UP: 'mdi:arrow-up',
|
|
35
|
+
DOWN: 'mdi:arrow-down',
|
|
36
36
|
// Workflow icons
|
|
37
|
-
WORKFLOW:
|
|
38
|
-
NODE_ADD:
|
|
39
|
-
NODE_DELETE:
|
|
40
|
-
CONNECTION:
|
|
37
|
+
WORKFLOW: 'mdi:graph',
|
|
38
|
+
NODE_ADD: 'mdi:plus-circle',
|
|
39
|
+
NODE_DELETE: 'mdi:minus-circle',
|
|
40
|
+
CONNECTION: 'mdi:connection',
|
|
41
41
|
// Data icons
|
|
42
|
-
DATA:
|
|
43
|
-
FILE:
|
|
44
|
-
TEXT:
|
|
45
|
-
JSON:
|
|
42
|
+
DATA: 'mdi:database',
|
|
43
|
+
FILE: 'mdi:file',
|
|
44
|
+
TEXT: 'mdi:text',
|
|
45
|
+
JSON: 'mdi:code-json',
|
|
46
46
|
// Model and processing icons
|
|
47
|
-
MODEL:
|
|
48
|
-
BRAIN:
|
|
49
|
-
VECTOR:
|
|
50
|
-
ROBOT:
|
|
47
|
+
MODEL: 'mdi:chip',
|
|
48
|
+
BRAIN: 'mdi:brain',
|
|
49
|
+
VECTOR: 'mdi:vector-point',
|
|
50
|
+
ROBOT: 'mdi:robot',
|
|
51
51
|
// Tool icons
|
|
52
|
-
TOOL:
|
|
53
|
-
CALCULATOR:
|
|
54
|
-
CLOCK:
|
|
52
|
+
TOOL: 'mdi:wrench',
|
|
53
|
+
CALCULATOR: 'mdi:calculator',
|
|
54
|
+
CLOCK: 'mdi:clock',
|
|
55
55
|
// Communication icons
|
|
56
|
-
CHAT:
|
|
57
|
-
MESSAGE:
|
|
58
|
-
EMAIL:
|
|
59
|
-
WEBHOOK:
|
|
56
|
+
CHAT: 'mdi:chat',
|
|
57
|
+
MESSAGE: 'mdi:message',
|
|
58
|
+
EMAIL: 'mdi:email',
|
|
59
|
+
WEBHOOK: 'mdi:webhook',
|
|
60
60
|
// Storage icons
|
|
61
|
-
STORAGE:
|
|
62
|
-
MEMORY:
|
|
63
|
-
CACHE:
|
|
61
|
+
STORAGE: 'mdi:database',
|
|
62
|
+
MEMORY: 'mdi:memory',
|
|
63
|
+
CACHE: 'mdi:cached',
|
|
64
64
|
// Processing icons
|
|
65
|
-
PROCESS:
|
|
66
|
-
FILTER:
|
|
67
|
-
SORT:
|
|
68
|
-
TRANSFORM:
|
|
65
|
+
PROCESS: 'mdi:cog',
|
|
66
|
+
FILTER: 'mdi:filter',
|
|
67
|
+
SORT: 'mdi:sort',
|
|
68
|
+
TRANSFORM: 'mdi:transform',
|
|
69
69
|
// Logic icons
|
|
70
|
-
LOGIC:
|
|
71
|
-
CONDITION:
|
|
72
|
-
LOOP:
|
|
70
|
+
LOGIC: 'mdi:git-branch',
|
|
71
|
+
CONDITION: 'mdi:source-fork',
|
|
72
|
+
LOOP: 'mdi:loop',
|
|
73
73
|
// Integration icons
|
|
74
|
-
API:
|
|
75
|
-
LINK:
|
|
76
|
-
PLUGIN:
|
|
77
|
-
BUNDLE:
|
|
74
|
+
API: 'mdi:api',
|
|
75
|
+
LINK: 'mdi:link',
|
|
76
|
+
PLUGIN: 'mdi:puzzle',
|
|
77
|
+
BUNDLE: 'mdi:package-variant'
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
80
80
|
* Category-specific icons matching Langflow's visual style
|
|
81
81
|
*/
|
|
82
82
|
export const CATEGORY_ICONS = {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
inputs: 'mdi:arrow-down-circle',
|
|
84
|
+
outputs: 'mdi:arrow-up-circle',
|
|
85
|
+
prompts: 'mdi:message-text',
|
|
86
|
+
models: 'mdi:robot',
|
|
87
|
+
processing: 'mdi:cog',
|
|
88
|
+
logic: 'mdi:source-branch',
|
|
89
|
+
data: 'mdi:database',
|
|
90
|
+
helpers: 'mdi:help-circle',
|
|
91
|
+
tools: 'mdi:wrench',
|
|
92
|
+
'vector stores': 'mdi:vector-square',
|
|
93
|
+
embeddings: 'mdi:vector-polygon',
|
|
94
|
+
memories: 'mdi:brain',
|
|
95
|
+
agents: 'mdi:account-cog',
|
|
96
|
+
ai: 'mdi:artificial-intelligence',
|
|
97
|
+
bundles: 'mdi:package-variant'
|
|
97
98
|
};
|
|
98
99
|
/**
|
|
99
100
|
* Get the appropriate icon for a node
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Status Utility Functions
|
|
3
|
+
* Provides utilities for managing and displaying node execution status
|
|
4
|
+
*/
|
|
5
|
+
import type { NodeExecutionStatus, NodeExecutionInfo } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get the display color for a node execution status
|
|
8
|
+
*/
|
|
9
|
+
export declare function getStatusColor(status: NodeExecutionStatus): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get the display icon for a node execution status
|
|
12
|
+
*/
|
|
13
|
+
export declare function getStatusIcon(status: NodeExecutionStatus): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get the display label for a node execution status
|
|
16
|
+
*/
|
|
17
|
+
export declare function getStatusLabel(status: NodeExecutionStatus): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get the background color for a node execution status overlay
|
|
20
|
+
*/
|
|
21
|
+
export declare function getStatusBackgroundColor(status: NodeExecutionStatus): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the text color for a node execution status overlay
|
|
24
|
+
*/
|
|
25
|
+
export declare function getStatusTextColor(status: NodeExecutionStatus): string;
|
|
26
|
+
/**
|
|
27
|
+
* Create a default NodeExecutionInfo object
|
|
28
|
+
*/
|
|
29
|
+
export declare function createDefaultExecutionInfo(): NodeExecutionInfo;
|
|
30
|
+
/**
|
|
31
|
+
* Update node execution info when execution starts
|
|
32
|
+
*/
|
|
33
|
+
export declare function updateExecutionStart(executionInfo: NodeExecutionInfo): NodeExecutionInfo;
|
|
34
|
+
/**
|
|
35
|
+
* Update node execution info when execution completes successfully
|
|
36
|
+
*/
|
|
37
|
+
export declare function updateExecutionComplete(executionInfo: NodeExecutionInfo, duration: number): NodeExecutionInfo;
|
|
38
|
+
/**
|
|
39
|
+
* Update node execution info when execution fails
|
|
40
|
+
*/
|
|
41
|
+
export declare function updateExecutionFailed(executionInfo: NodeExecutionInfo, error: string, duration: number): NodeExecutionInfo;
|
|
42
|
+
/**
|
|
43
|
+
* Reset node execution info
|
|
44
|
+
*/
|
|
45
|
+
export declare function resetExecutionInfo(executionInfo: NodeExecutionInfo): NodeExecutionInfo;
|
|
46
|
+
/**
|
|
47
|
+
* Format execution duration for display
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatExecutionDuration(duration?: number): string;
|
|
50
|
+
/**
|
|
51
|
+
* Format last executed timestamp for display
|
|
52
|
+
*/
|
|
53
|
+
export declare function formatLastExecuted(timestamp?: string): string;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Status Utility Functions
|
|
3
|
+
* Provides utilities for managing and displaying node execution status
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get the display color for a node execution status
|
|
7
|
+
*/
|
|
8
|
+
export function getStatusColor(status) {
|
|
9
|
+
const statusColors = {
|
|
10
|
+
idle: '#6b7280', // gray
|
|
11
|
+
pending: '#f59e0b', // amber
|
|
12
|
+
running: '#3b82f6', // blue
|
|
13
|
+
completed: '#10b981', // emerald
|
|
14
|
+
failed: '#ef4444', // red
|
|
15
|
+
cancelled: '#6b7280', // gray
|
|
16
|
+
skipped: '#8b5cf6' // violet
|
|
17
|
+
};
|
|
18
|
+
return statusColors[status] || statusColors.idle;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the display icon for a node execution status
|
|
22
|
+
*/
|
|
23
|
+
export function getStatusIcon(status) {
|
|
24
|
+
const statusIcons = {
|
|
25
|
+
idle: 'mdi:circle-outline',
|
|
26
|
+
pending: 'mdi:clock-outline',
|
|
27
|
+
running: 'mdi:loading',
|
|
28
|
+
completed: 'mdi:check-circle',
|
|
29
|
+
failed: 'mdi:alert-circle',
|
|
30
|
+
cancelled: 'mdi:cancel',
|
|
31
|
+
skipped: 'mdi:skip-next'
|
|
32
|
+
};
|
|
33
|
+
return statusIcons[status] || statusIcons.idle;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get the display label for a node execution status
|
|
37
|
+
*/
|
|
38
|
+
export function getStatusLabel(status) {
|
|
39
|
+
const statusLabels = {
|
|
40
|
+
idle: 'Idle',
|
|
41
|
+
pending: 'Pending',
|
|
42
|
+
running: 'Running',
|
|
43
|
+
completed: 'Completed',
|
|
44
|
+
failed: 'Failed',
|
|
45
|
+
cancelled: 'Cancelled',
|
|
46
|
+
skipped: 'Skipped'
|
|
47
|
+
};
|
|
48
|
+
return statusLabels[status] || statusLabels.idle;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the background color for a node execution status overlay
|
|
52
|
+
*/
|
|
53
|
+
export function getStatusBackgroundColor(status) {
|
|
54
|
+
const statusBackgroundColors = {
|
|
55
|
+
idle: '#f9fafb', // light gray
|
|
56
|
+
pending: '#fef3c7', // light amber
|
|
57
|
+
running: '#dbeafe', // light blue
|
|
58
|
+
completed: '#d1fae5', // light emerald
|
|
59
|
+
failed: '#fee2e2', // light red
|
|
60
|
+
cancelled: '#f3f4f6', // light gray
|
|
61
|
+
skipped: '#ede9fe' // light violet
|
|
62
|
+
};
|
|
63
|
+
return statusBackgroundColors[status] || statusBackgroundColors.idle;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get the text color for a node execution status overlay
|
|
67
|
+
*/
|
|
68
|
+
export function getStatusTextColor(status) {
|
|
69
|
+
const statusTextColors = {
|
|
70
|
+
idle: '#6b7280', // gray
|
|
71
|
+
pending: '#d97706', // amber
|
|
72
|
+
running: '#1d4ed8', // blue
|
|
73
|
+
completed: '#059669', // emerald
|
|
74
|
+
failed: '#dc2626', // red
|
|
75
|
+
cancelled: '#6b7280', // gray
|
|
76
|
+
skipped: '#7c3aed' // violet
|
|
77
|
+
};
|
|
78
|
+
return statusTextColors[status] || statusTextColors.idle;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a default NodeExecutionInfo object
|
|
82
|
+
*/
|
|
83
|
+
export function createDefaultExecutionInfo() {
|
|
84
|
+
return {
|
|
85
|
+
status: 'idle',
|
|
86
|
+
executionCount: 0,
|
|
87
|
+
isExecuting: false
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Update node execution info when execution starts
|
|
92
|
+
*/
|
|
93
|
+
export function updateExecutionStart(executionInfo) {
|
|
94
|
+
return {
|
|
95
|
+
...executionInfo,
|
|
96
|
+
status: 'running',
|
|
97
|
+
isExecuting: true
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Update node execution info when execution completes successfully
|
|
102
|
+
*/
|
|
103
|
+
export function updateExecutionComplete(executionInfo, duration) {
|
|
104
|
+
return {
|
|
105
|
+
...executionInfo,
|
|
106
|
+
status: 'completed',
|
|
107
|
+
executionCount: executionInfo.executionCount + 1,
|
|
108
|
+
lastExecuted: new Date().toISOString(),
|
|
109
|
+
lastExecutionDuration: duration,
|
|
110
|
+
isExecuting: false,
|
|
111
|
+
lastError: undefined // Clear any previous error
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Update node execution info when execution fails
|
|
116
|
+
*/
|
|
117
|
+
export function updateExecutionFailed(executionInfo, error, duration) {
|
|
118
|
+
return {
|
|
119
|
+
...executionInfo,
|
|
120
|
+
status: 'failed',
|
|
121
|
+
executionCount: executionInfo.executionCount + 1,
|
|
122
|
+
lastExecuted: new Date().toISOString(),
|
|
123
|
+
lastExecutionDuration: duration,
|
|
124
|
+
isExecuting: false,
|
|
125
|
+
lastError: error
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Reset node execution info
|
|
130
|
+
*/
|
|
131
|
+
export function resetExecutionInfo(executionInfo) {
|
|
132
|
+
return {
|
|
133
|
+
...executionInfo,
|
|
134
|
+
status: 'idle',
|
|
135
|
+
isExecuting: false,
|
|
136
|
+
lastError: undefined
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Format execution duration for display
|
|
141
|
+
*/
|
|
142
|
+
export function formatExecutionDuration(duration) {
|
|
143
|
+
if (!duration)
|
|
144
|
+
return 'N/A';
|
|
145
|
+
if (duration < 1000) {
|
|
146
|
+
return `${Math.round(duration)}ms`;
|
|
147
|
+
}
|
|
148
|
+
else if (duration < 60000) {
|
|
149
|
+
return `${(duration / 1000).toFixed(1)}s`;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const minutes = Math.floor(duration / 60000);
|
|
153
|
+
const seconds = Math.floor((duration % 60000) / 1000);
|
|
154
|
+
return `${minutes}m ${seconds}s`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Format last executed timestamp for display
|
|
159
|
+
*/
|
|
160
|
+
export function formatLastExecuted(timestamp) {
|
|
161
|
+
if (!timestamp)
|
|
162
|
+
return 'Never';
|
|
163
|
+
const date = new Date(timestamp);
|
|
164
|
+
const now = new Date();
|
|
165
|
+
const diffMs = now.getTime() - date.getTime();
|
|
166
|
+
if (diffMs < 60000) {
|
|
167
|
+
// Less than 1 minute
|
|
168
|
+
return 'Just now';
|
|
169
|
+
}
|
|
170
|
+
else if (diffMs < 3600000) {
|
|
171
|
+
// Less than 1 hour
|
|
172
|
+
const minutes = Math.floor(diffMs / 60000);
|
|
173
|
+
return `${minutes}m ago`;
|
|
174
|
+
}
|
|
175
|
+
else if (diffMs < 86400000) {
|
|
176
|
+
// Less than 1 day
|
|
177
|
+
const hours = Math.floor(diffMs / 3600000);
|
|
178
|
+
return `${hours}h ago`;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
return date.toLocaleDateString();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node type utilities for FlowDrop
|
|
3
|
+
* Handles dynamic node type resolution based on NodeMetadata
|
|
4
|
+
*/
|
|
5
|
+
import type { NodeType, NodeMetadata } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Gets the SvelteFlow component name for a given NodeType
|
|
8
|
+
*/
|
|
9
|
+
export declare function getComponentNameForNodeType(nodeType: NodeType): string;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the available node types for a given NodeMetadata
|
|
12
|
+
* Priority: supportedTypes > type > "default"
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAvailableNodeTypes(metadata: NodeMetadata): NodeType[];
|
|
15
|
+
/**
|
|
16
|
+
* Gets the primary (default) node type for a given NodeMetadata
|
|
17
|
+
* This is used when no specific type is configured by the user
|
|
18
|
+
*/
|
|
19
|
+
export declare function getPrimaryNodeType(metadata: NodeMetadata): NodeType;
|
|
20
|
+
/**
|
|
21
|
+
* Determines the appropriate node type based on configuration and metadata
|
|
22
|
+
* Priority:
|
|
23
|
+
* 1. configNodeType (if valid for this metadata)
|
|
24
|
+
* 2. metadata.type (if valid)
|
|
25
|
+
* 3. First supportedType
|
|
26
|
+
* 4. "default"
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveNodeType(metadata: NodeMetadata, configNodeType?: string): NodeType;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the SvelteFlow component name for resolved node type
|
|
31
|
+
* This replaces the old mapNodeType function
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveComponentName(metadata: NodeMetadata, configNodeType?: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Validates if a node type is supported by the given metadata
|
|
36
|
+
*/
|
|
37
|
+
export declare function isNodeTypeSupported(metadata: NodeMetadata, nodeType: NodeType): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Gets enum options for node type configuration
|
|
40
|
+
* Used in config schemas to show available options
|
|
41
|
+
*/
|
|
42
|
+
export declare function getNodeTypeEnumOptions(metadata: NodeMetadata): {
|
|
43
|
+
enum: string[];
|
|
44
|
+
enumNames: string[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Creates a nodeType config property that respects supportedTypes
|
|
48
|
+
* This replaces hardcoded enum values in config schemas
|
|
49
|
+
*/
|
|
50
|
+
export declare function createNodeTypeConfigProperty(metadata: NodeMetadata, defaultType?: NodeType): {
|
|
51
|
+
type: "string";
|
|
52
|
+
title: string;
|
|
53
|
+
description: string;
|
|
54
|
+
default: NodeType;
|
|
55
|
+
enum: string[];
|
|
56
|
+
enumNames: string[];
|
|
57
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node type utilities for FlowDrop
|
|
3
|
+
* Handles dynamic node type resolution based on NodeMetadata
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Maps NodeType to SvelteFlow component names
|
|
7
|
+
*/
|
|
8
|
+
const NODE_TYPE_TO_COMPONENT_MAP = {
|
|
9
|
+
note: 'note',
|
|
10
|
+
simple: 'simple',
|
|
11
|
+
square: 'square',
|
|
12
|
+
tool: 'tool',
|
|
13
|
+
gateway: 'gateway',
|
|
14
|
+
default: 'workflowNode'
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Gets the SvelteFlow component name for a given NodeType
|
|
18
|
+
*/
|
|
19
|
+
export function getComponentNameForNodeType(nodeType) {
|
|
20
|
+
return NODE_TYPE_TO_COMPONENT_MAP[nodeType] || 'workflowNode';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets the available node types for a given NodeMetadata
|
|
24
|
+
* Priority: supportedTypes > type > "default"
|
|
25
|
+
*/
|
|
26
|
+
export function getAvailableNodeTypes(metadata) {
|
|
27
|
+
if (metadata.supportedTypes && metadata.supportedTypes.length > 0) {
|
|
28
|
+
return metadata.supportedTypes;
|
|
29
|
+
}
|
|
30
|
+
if (metadata.type) {
|
|
31
|
+
return [metadata.type];
|
|
32
|
+
}
|
|
33
|
+
return ['default'];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the primary (default) node type for a given NodeMetadata
|
|
37
|
+
* This is used when no specific type is configured by the user
|
|
38
|
+
*/
|
|
39
|
+
export function getPrimaryNodeType(metadata) {
|
|
40
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
41
|
+
return availableTypes[0];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Determines the appropriate node type based on configuration and metadata
|
|
45
|
+
* Priority:
|
|
46
|
+
* 1. configNodeType (if valid for this metadata)
|
|
47
|
+
* 2. metadata.type (if valid)
|
|
48
|
+
* 3. First supportedType
|
|
49
|
+
* 4. "default"
|
|
50
|
+
*/
|
|
51
|
+
export function resolveNodeType(metadata, configNodeType) {
|
|
52
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
53
|
+
// Check if configNodeType is valid for this metadata
|
|
54
|
+
if (configNodeType && availableTypes.includes(configNodeType)) {
|
|
55
|
+
return configNodeType;
|
|
56
|
+
}
|
|
57
|
+
// Fall back to primary type
|
|
58
|
+
return getPrimaryNodeType(metadata);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the SvelteFlow component name for resolved node type
|
|
62
|
+
* This replaces the old mapNodeType function
|
|
63
|
+
*/
|
|
64
|
+
export function resolveComponentName(metadata, configNodeType) {
|
|
65
|
+
const nodeType = resolveNodeType(metadata, configNodeType);
|
|
66
|
+
return getComponentNameForNodeType(nodeType);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validates if a node type is supported by the given metadata
|
|
70
|
+
*/
|
|
71
|
+
export function isNodeTypeSupported(metadata, nodeType) {
|
|
72
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
73
|
+
return availableTypes.includes(nodeType);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Gets enum options for node type configuration
|
|
77
|
+
* Used in config schemas to show available options
|
|
78
|
+
*/
|
|
79
|
+
export function getNodeTypeEnumOptions(metadata) {
|
|
80
|
+
const availableTypes = getAvailableNodeTypes(metadata);
|
|
81
|
+
const typeDisplayNames = {
|
|
82
|
+
note: 'Note (sticky note style)',
|
|
83
|
+
simple: 'Simple (compact layout)',
|
|
84
|
+
square: 'Square (geometric layout)',
|
|
85
|
+
tool: 'Tool (specialized for agent tools)',
|
|
86
|
+
gateway: 'Gateway (branching control flow)',
|
|
87
|
+
default: 'Default (standard workflow node)'
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
enum: availableTypes,
|
|
91
|
+
enumNames: availableTypes.map((type) => typeDisplayNames[type] || type)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Creates a nodeType config property that respects supportedTypes
|
|
96
|
+
* This replaces hardcoded enum values in config schemas
|
|
97
|
+
*/
|
|
98
|
+
export function createNodeTypeConfigProperty(metadata, defaultType) {
|
|
99
|
+
const { enum: enumValues, enumNames } = getNodeTypeEnumOptions(metadata);
|
|
100
|
+
const primaryType = defaultType || getPrimaryNodeType(metadata);
|
|
101
|
+
return {
|
|
102
|
+
type: 'string',
|
|
103
|
+
title: 'Node Type',
|
|
104
|
+
description: 'Choose the visual representation for this node',
|
|
105
|
+
default: primaryType,
|
|
106
|
+
enum: enumValues,
|
|
107
|
+
enumNames
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Wrapper Utilities
|
|
3
|
+
* Provides utilities for wrapping nodes with status overlays
|
|
4
|
+
*/
|
|
5
|
+
import type { NodeExecutionInfo } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for node status overlay
|
|
8
|
+
*/
|
|
9
|
+
export interface NodeStatusConfig {
|
|
10
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
11
|
+
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
showDetails?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default configuration for node status overlays
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_NODE_STATUS_CONFIG: NodeStatusConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Create a node wrapper configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare function createNodeWrapperConfig(nodeId: string, executionInfo?: NodeExecutionInfo, config?: NodeStatusConfig): {
|
|
22
|
+
nodeId: string;
|
|
23
|
+
executionInfo?: NodeExecutionInfo;
|
|
24
|
+
statusPosition: NodeStatusConfig['position'];
|
|
25
|
+
statusSize: NodeStatusConfig['size'];
|
|
26
|
+
showStatusDetails: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Check if a node should show status overlay
|
|
30
|
+
*/
|
|
31
|
+
export declare function shouldShowNodeStatus(executionInfo?: NodeExecutionInfo): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Get optimal status position based on node type
|
|
34
|
+
*/
|
|
35
|
+
export declare function getOptimalStatusPosition(nodeType: string): NodeStatusConfig['position'];
|
|
36
|
+
/**
|
|
37
|
+
* Get optimal status size based on node type
|
|
38
|
+
*/
|
|
39
|
+
export declare function getOptimalStatusSize(nodeType: string): NodeStatusConfig['size'];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Wrapper Utilities
|
|
3
|
+
* Provides utilities for wrapping nodes with status overlays
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Default configuration for node status overlays
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_NODE_STATUS_CONFIG = {
|
|
9
|
+
position: 'top-right',
|
|
10
|
+
size: 'md',
|
|
11
|
+
showDetails: true
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Create a node wrapper configuration
|
|
15
|
+
*/
|
|
16
|
+
export function createNodeWrapperConfig(nodeId, executionInfo, config = {}) {
|
|
17
|
+
return {
|
|
18
|
+
nodeId,
|
|
19
|
+
executionInfo,
|
|
20
|
+
statusPosition: config.position || DEFAULT_NODE_STATUS_CONFIG.position,
|
|
21
|
+
statusSize: config.size || DEFAULT_NODE_STATUS_CONFIG.size,
|
|
22
|
+
showStatusDetails: config.showDetails ?? DEFAULT_NODE_STATUS_CONFIG.showDetails
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if a node should show status overlay
|
|
27
|
+
*/
|
|
28
|
+
export function shouldShowNodeStatus(executionInfo) {
|
|
29
|
+
if (!executionInfo)
|
|
30
|
+
return false;
|
|
31
|
+
return (executionInfo.status !== 'idle' || executionInfo.executionCount > 0 || executionInfo.isExecuting);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get optimal status position based on node type
|
|
35
|
+
*/
|
|
36
|
+
export function getOptimalStatusPosition(nodeType) {
|
|
37
|
+
switch (nodeType) {
|
|
38
|
+
case 'tool':
|
|
39
|
+
return 'top-left';
|
|
40
|
+
case 'note':
|
|
41
|
+
return 'bottom-right';
|
|
42
|
+
case 'simple':
|
|
43
|
+
case 'square':
|
|
44
|
+
default:
|
|
45
|
+
return 'top-right';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get optimal status size based on node type
|
|
50
|
+
*/
|
|
51
|
+
export function getOptimalStatusSize(nodeType) {
|
|
52
|
+
switch (nodeType) {
|
|
53
|
+
case 'tool':
|
|
54
|
+
return 'sm';
|
|
55
|
+
case 'note':
|
|
56
|
+
return 'sm';
|
|
57
|
+
case 'simple':
|
|
58
|
+
case 'square':
|
|
59
|
+
default:
|
|
60
|
+
return 'md';
|
|
61
|
+
}
|
|
62
|
+
}
|