@marktoflow/gui 2.0.0-alpha.1 → 2.0.0-alpha.3
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/.turbo/turbo-build.log +7 -7
- package/README.md +38 -2
- package/dist/client/assets/index-C90Y_aBX.js +678 -0
- package/dist/client/assets/index-C90Y_aBX.js.map +1 -0
- package/dist/client/assets/index-CRWeQ3NN.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/server/index.js +1 -1
- package/dist/server/server/routes/tools.js +406 -0
- package/dist/server/server/routes/tools.js.map +1 -1
- package/dist/server/server/services/agents/codex-provider.js +270 -0
- package/dist/server/server/services/agents/codex-provider.js.map +1 -0
- package/dist/server/server/services/agents/prompts.js +27 -0
- package/dist/server/server/services/agents/prompts.js.map +1 -1
- package/dist/server/server/services/agents/registry.js +20 -0
- package/dist/server/server/services/agents/registry.js.map +1 -1
- package/package.json +6 -6
- package/src/client/components/Canvas/Canvas.tsx +24 -6
- package/src/client/components/Canvas/ForEachNode.tsx +128 -0
- package/src/client/components/Canvas/IfElseNode.tsx +126 -0
- package/src/client/components/Canvas/ParallelNode.tsx +140 -0
- package/src/client/components/Canvas/SwitchNode.tsx +164 -0
- package/src/client/components/Canvas/TransformNode.tsx +185 -0
- package/src/client/components/Canvas/TryCatchNode.tsx +164 -0
- package/src/client/components/Canvas/WhileNode.tsx +129 -0
- package/src/client/components/Canvas/index.ts +24 -0
- package/src/client/utils/serviceIcons.tsx +33 -0
- package/src/server/index.ts +1 -1
- package/src/server/routes/tools.ts +406 -0
- package/src/server/services/agents/codex-provider.ts +398 -0
- package/src/server/services/agents/prompts.ts +27 -0
- package/src/server/services/agents/registry.ts +21 -0
- package/tailwind.config.ts +1 -1
- package/tests/integration/api.test.ts +203 -1
- package/tests/integration/testApp.ts +1 -1
- package/tests/setup.ts +35 -0
- package/tests/unit/ForEachNode.test.tsx +218 -0
- package/tests/unit/IfElseNode.test.tsx +188 -0
- package/tests/unit/ParallelNode.test.tsx +264 -0
- package/tests/unit/SwitchNode.test.tsx +252 -0
- package/tests/unit/TransformNode.test.tsx +386 -0
- package/tests/unit/TryCatchNode.test.tsx +243 -0
- package/tests/unit/WhileNode.test.tsx +226 -0
- package/tests/unit/codexProvider.test.ts +399 -0
- package/tests/unit/serviceIcons.test.ts +197 -0
- package/.turbo/turbo-test.log +0 -22
- package/dist/client/assets/index-DwTI8opO.js +0 -608
- package/dist/client/assets/index-DwTI8opO.js.map +0 -1
- package/dist/client/assets/index-RoEdL6gO.css +0 -1
- package/dist/server/index.d.ts +0 -3
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -56
- package/dist/server/index.js.map +0 -1
- package/dist/server/routes/ai.js +0 -50
- package/dist/server/routes/ai.js.map +0 -1
- package/dist/server/routes/execute.js +0 -62
- package/dist/server/routes/execute.js.map +0 -1
- package/dist/server/routes/workflows.js +0 -99
- package/dist/server/routes/workflows.js.map +0 -1
- package/dist/server/services/AIService.d.ts +0 -30
- package/dist/server/services/AIService.d.ts.map +0 -1
- package/dist/server/services/AIService.js +0 -216
- package/dist/server/services/AIService.js.map +0 -1
- package/dist/server/services/FileWatcher.d.ts +0 -10
- package/dist/server/services/FileWatcher.d.ts.map +0 -1
- package/dist/server/services/FileWatcher.js +0 -62
- package/dist/server/services/FileWatcher.js.map +0 -1
- package/dist/server/services/WorkflowService.d.ts +0 -54
- package/dist/server/services/WorkflowService.d.ts.map +0 -1
- package/dist/server/services/WorkflowService.js +0 -323
- package/dist/server/services/WorkflowService.js.map +0 -1
- package/dist/server/websocket/index.d.ts +0 -10
- package/dist/server/websocket/index.d.ts.map +0 -1
- package/dist/server/websocket/index.js +0 -85
- package/dist/server/websocket/index.js.map +0 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { Handle, Position, type Node, type NodeProps } from '@xyflow/react';
|
|
3
|
+
import {
|
|
4
|
+
ArrowRight,
|
|
5
|
+
Filter,
|
|
6
|
+
Minimize2,
|
|
7
|
+
CheckCircle,
|
|
8
|
+
XCircle,
|
|
9
|
+
Clock,
|
|
10
|
+
} from 'lucide-react';
|
|
11
|
+
|
|
12
|
+
export interface TransformNodeData extends Record<string, unknown> {
|
|
13
|
+
id: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
transformType: 'map' | 'filter' | 'reduce';
|
|
16
|
+
items: string;
|
|
17
|
+
itemVariable?: string;
|
|
18
|
+
expression?: string;
|
|
19
|
+
condition?: string;
|
|
20
|
+
accumulatorVariable?: string;
|
|
21
|
+
initialValue?: unknown;
|
|
22
|
+
status?: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
23
|
+
inputCount?: number;
|
|
24
|
+
outputCount?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type TransformNodeType = Node<TransformNodeData, 'map' | 'filter' | 'reduce'>;
|
|
28
|
+
|
|
29
|
+
function TransformNodeComponent({ data, selected }: NodeProps<TransformNodeType>) {
|
|
30
|
+
const transformConfig: Record<
|
|
31
|
+
NonNullable<TransformNodeData['transformType']>,
|
|
32
|
+
{ icon: typeof ArrowRight; label: string; color: string }
|
|
33
|
+
> = {
|
|
34
|
+
map: { icon: ArrowRight, label: 'Map', color: '#14b8a6' },
|
|
35
|
+
filter: { icon: Filter, label: 'Filter', color: '#10b981' },
|
|
36
|
+
reduce: { icon: Minimize2, label: 'Reduce', color: '#06b6d4' },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const statusConfig: Record<
|
|
40
|
+
NonNullable<TransformNodeData['status']>,
|
|
41
|
+
{ icon: typeof Clock; color: string; bgColor: string; animate?: boolean }
|
|
42
|
+
> = {
|
|
43
|
+
pending: { icon: Clock, color: 'text-gray-400', bgColor: 'bg-gray-400/10' },
|
|
44
|
+
running: {
|
|
45
|
+
icon: transformConfig[data.transformType].icon,
|
|
46
|
+
color: 'text-teal-400',
|
|
47
|
+
bgColor: 'bg-teal-400/10',
|
|
48
|
+
animate: true,
|
|
49
|
+
},
|
|
50
|
+
completed: {
|
|
51
|
+
icon: CheckCircle,
|
|
52
|
+
color: 'text-success',
|
|
53
|
+
bgColor: 'bg-success/10',
|
|
54
|
+
},
|
|
55
|
+
failed: { icon: XCircle, color: 'text-error', bgColor: 'bg-error/10' },
|
|
56
|
+
skipped: {
|
|
57
|
+
icon: XCircle,
|
|
58
|
+
color: 'text-gray-500',
|
|
59
|
+
bgColor: 'bg-gray-500/10',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const status = data.status || 'pending';
|
|
64
|
+
const statusCfg = statusConfig[status];
|
|
65
|
+
const StatusIcon = statusCfg.icon;
|
|
66
|
+
|
|
67
|
+
const transformCfg = transformConfig[data.transformType];
|
|
68
|
+
const TransformIcon = transformCfg.icon;
|
|
69
|
+
|
|
70
|
+
const displayExpression =
|
|
71
|
+
data.transformType === 'filter'
|
|
72
|
+
? data.condition
|
|
73
|
+
: data.transformType === 'reduce'
|
|
74
|
+
? `${data.accumulatorVariable || 'acc'}: ${data.expression || 'Not set'}`
|
|
75
|
+
: data.expression;
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div
|
|
79
|
+
className={`control-flow-node transform-node p-0 ${selected ? 'selected' : ''} ${status === 'running' ? 'running' : ''}`}
|
|
80
|
+
style={{
|
|
81
|
+
background: 'linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%)',
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
{/* Input handle */}
|
|
85
|
+
<Handle
|
|
86
|
+
type="target"
|
|
87
|
+
position={Position.Top}
|
|
88
|
+
className="!w-3 !h-3 !bg-primary !border-2 !border-node-bg"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
{/* Node header */}
|
|
92
|
+
<div className="flex items-center gap-3 p-3 border-b border-white/20">
|
|
93
|
+
<div className="w-8 h-8 rounded-lg bg-white/20 flex items-center justify-center">
|
|
94
|
+
<TransformIcon className="w-5 h-5 text-white" />
|
|
95
|
+
</div>
|
|
96
|
+
<div className="flex-1 min-w-0">
|
|
97
|
+
<div className="text-sm font-medium text-white">
|
|
98
|
+
{data.name || transformCfg.label}
|
|
99
|
+
</div>
|
|
100
|
+
<div className="text-xs text-white/70">Transform</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div
|
|
103
|
+
className={`w-6 h-6 rounded-full ${statusCfg.bgColor} flex items-center justify-center`}
|
|
104
|
+
>
|
|
105
|
+
<StatusIcon
|
|
106
|
+
className={`w-4 h-4 ${statusCfg.color} ${statusCfg.animate ? 'animate-pulse' : ''}`}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
{/* Node body */}
|
|
112
|
+
<div className="p-3 bg-white/10">
|
|
113
|
+
{/* Items source */}
|
|
114
|
+
<div className="text-xs text-white/90 mb-2">
|
|
115
|
+
<span className="text-white/60">Items:</span>{' '}
|
|
116
|
+
<span className="font-mono">{data.items || 'Not set'}</span>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
{/* Variable */}
|
|
120
|
+
<div className="text-xs text-white/90 mb-3">
|
|
121
|
+
<span className="text-white/60">Variable:</span>{' '}
|
|
122
|
+
<span className="font-mono">{data.itemVariable || 'item'}</span>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
{/* Expression/Condition */}
|
|
126
|
+
<div className="mb-3 p-2 bg-white/5 rounded">
|
|
127
|
+
<div className="text-xs text-white/60 mb-1">
|
|
128
|
+
{data.transformType === 'filter'
|
|
129
|
+
? 'Condition'
|
|
130
|
+
: data.transformType === 'reduce'
|
|
131
|
+
? 'Reducer'
|
|
132
|
+
: 'Expression'}
|
|
133
|
+
</div>
|
|
134
|
+
<div className="text-xs text-white font-mono break-all">
|
|
135
|
+
{displayExpression || 'Not set'}
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
{/* Initial value for reduce */}
|
|
140
|
+
{data.transformType === 'reduce' && data.initialValue !== undefined && (
|
|
141
|
+
<div className="text-xs text-white/90 mb-3">
|
|
142
|
+
<span className="text-white/60">Initial:</span>{' '}
|
|
143
|
+
<span className="font-mono">{JSON.stringify(data.initialValue)}</span>
|
|
144
|
+
</div>
|
|
145
|
+
)}
|
|
146
|
+
|
|
147
|
+
{/* Input/Output count */}
|
|
148
|
+
{(data.inputCount !== undefined || data.outputCount !== undefined) && (
|
|
149
|
+
<div className="mt-3 p-2 bg-white/5 rounded flex items-center justify-between">
|
|
150
|
+
<div className="text-xs">
|
|
151
|
+
<span className="text-white/60">In:</span>{' '}
|
|
152
|
+
<span className="text-white font-medium">{data.inputCount ?? '?'}</span>
|
|
153
|
+
</div>
|
|
154
|
+
<div className="text-white/40">→</div>
|
|
155
|
+
<div className="text-xs">
|
|
156
|
+
<span className="text-white/60">Out:</span>{' '}
|
|
157
|
+
<span className="text-white font-medium">{data.outputCount ?? '?'}</span>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
161
|
+
|
|
162
|
+
{/* Transform type indicator */}
|
|
163
|
+
<div className="mt-3 text-xs text-white/50 flex items-center gap-2">
|
|
164
|
+
<span>ℹ️</span>
|
|
165
|
+
<span>
|
|
166
|
+
{data.transformType === 'map'
|
|
167
|
+
? 'Transforms each item'
|
|
168
|
+
: data.transformType === 'filter'
|
|
169
|
+
? 'Selects matching items'
|
|
170
|
+
: 'Aggregates to single value'}
|
|
171
|
+
</span>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
{/* Output handle */}
|
|
176
|
+
<Handle
|
|
177
|
+
type="source"
|
|
178
|
+
position={Position.Bottom}
|
|
179
|
+
className="!w-3 !h-3 !bg-primary !border-2 !border-node-bg"
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export const TransformNode = memo(TransformNodeComponent);
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { Handle, Position, type Node, type NodeProps } from '@xyflow/react';
|
|
3
|
+
import { Shield, CheckCircle, XCircle, Clock, AlertTriangle } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
export interface TryCatchNodeData extends Record<string, unknown> {
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
hasCatch?: boolean;
|
|
9
|
+
hasFinally?: boolean;
|
|
10
|
+
status?: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
11
|
+
activeBranch?: 'try' | 'catch' | 'finally' | null;
|
|
12
|
+
errorOccurred?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type TryCatchNodeType = Node<TryCatchNodeData, 'try'>;
|
|
16
|
+
|
|
17
|
+
function TryCatchNodeComponent({ data, selected }: NodeProps<TryCatchNodeType>) {
|
|
18
|
+
const statusConfig: Record<
|
|
19
|
+
NonNullable<TryCatchNodeData['status']>,
|
|
20
|
+
{ icon: typeof Clock; color: string; bgColor: string; animate?: boolean }
|
|
21
|
+
> = {
|
|
22
|
+
pending: { icon: Clock, color: 'text-gray-400', bgColor: 'bg-gray-400/10' },
|
|
23
|
+
running: {
|
|
24
|
+
icon: Shield,
|
|
25
|
+
color: 'text-yellow-400',
|
|
26
|
+
bgColor: 'bg-yellow-400/10',
|
|
27
|
+
animate: true,
|
|
28
|
+
},
|
|
29
|
+
completed: {
|
|
30
|
+
icon: CheckCircle,
|
|
31
|
+
color: 'text-success',
|
|
32
|
+
bgColor: 'bg-success/10',
|
|
33
|
+
},
|
|
34
|
+
failed: { icon: XCircle, color: 'text-error', bgColor: 'bg-error/10' },
|
|
35
|
+
skipped: {
|
|
36
|
+
icon: XCircle,
|
|
37
|
+
color: 'text-gray-500',
|
|
38
|
+
bgColor: 'bg-gray-500/10',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const status = data.status || 'pending';
|
|
43
|
+
const config = statusConfig[status];
|
|
44
|
+
const StatusIcon = config.icon;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
className={`control-flow-node try-catch-node p-0 ${selected ? 'selected' : ''} ${status === 'running' ? 'running' : ''}`}
|
|
49
|
+
style={{
|
|
50
|
+
background: 'linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%)',
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
{/* Input handle */}
|
|
54
|
+
<Handle
|
|
55
|
+
type="target"
|
|
56
|
+
position={Position.Top}
|
|
57
|
+
className="!w-3 !h-3 !bg-primary !border-2 !border-node-bg"
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
{/* Node header */}
|
|
61
|
+
<div className="flex items-center gap-3 p-3 border-b border-white/20">
|
|
62
|
+
<div className="w-8 h-8 rounded-lg bg-white/20 flex items-center justify-center">
|
|
63
|
+
<Shield className="w-5 h-5 text-white" />
|
|
64
|
+
</div>
|
|
65
|
+
<div className="flex-1 min-w-0">
|
|
66
|
+
<div className="text-sm font-medium text-white">
|
|
67
|
+
{data.name || 'Try/Catch'}
|
|
68
|
+
</div>
|
|
69
|
+
<div className="text-xs text-white/70">Error Handling</div>
|
|
70
|
+
</div>
|
|
71
|
+
<div
|
|
72
|
+
className={`w-6 h-6 rounded-full ${config.bgColor} flex items-center justify-center`}
|
|
73
|
+
>
|
|
74
|
+
<StatusIcon
|
|
75
|
+
className={`w-4 h-4 ${config.color} ${config.animate ? 'animate-pulse' : ''}`}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{/* Node body */}
|
|
81
|
+
<div className="p-3 bg-white/10">
|
|
82
|
+
{/* Error indicator */}
|
|
83
|
+
{data.errorOccurred && (
|
|
84
|
+
<div className="mb-3 p-2 bg-red-500/20 border border-red-500/30 rounded flex items-center gap-2">
|
|
85
|
+
<AlertTriangle className="w-4 h-4 text-red-200" />
|
|
86
|
+
<span className="text-xs text-red-200 font-medium">Error occurred</span>
|
|
87
|
+
</div>
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
{/* Branch indicators */}
|
|
91
|
+
<div className="space-y-2">
|
|
92
|
+
<div
|
|
93
|
+
className={`text-center p-2 rounded text-xs font-medium transition-colors ${
|
|
94
|
+
data.activeBranch === 'try'
|
|
95
|
+
? 'bg-blue-500/30 text-blue-200 ring-1 ring-blue-400/50'
|
|
96
|
+
: 'bg-white/5 text-white/60'
|
|
97
|
+
}`}
|
|
98
|
+
>
|
|
99
|
+
✓ Try
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
{data.hasCatch && (
|
|
103
|
+
<div
|
|
104
|
+
className={`text-center p-2 rounded text-xs font-medium transition-colors ${
|
|
105
|
+
data.activeBranch === 'catch'
|
|
106
|
+
? 'bg-red-500/30 text-red-200 ring-1 ring-red-400/50'
|
|
107
|
+
: 'bg-white/5 text-white/60'
|
|
108
|
+
}`}
|
|
109
|
+
>
|
|
110
|
+
⚠ Catch
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
{data.hasFinally && (
|
|
115
|
+
<div
|
|
116
|
+
className={`text-center p-2 rounded text-xs font-medium transition-colors ${
|
|
117
|
+
data.activeBranch === 'finally'
|
|
118
|
+
? 'bg-purple-500/30 text-purple-200 ring-1 ring-purple-400/50'
|
|
119
|
+
: 'bg-white/5 text-white/60'
|
|
120
|
+
}`}
|
|
121
|
+
>
|
|
122
|
+
⟳ Finally
|
|
123
|
+
</div>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
{/* Info */}
|
|
128
|
+
<div className="mt-3 text-xs text-white/50 flex items-center gap-2">
|
|
129
|
+
<span>ℹ️</span>
|
|
130
|
+
<span>Finally always executes</span>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
{/* Output handles */}
|
|
135
|
+
<Handle
|
|
136
|
+
type="source"
|
|
137
|
+
position={Position.Bottom}
|
|
138
|
+
id="try"
|
|
139
|
+
style={{ left: '25%' }}
|
|
140
|
+
className="!w-2.5 !h-2.5 !bg-blue-500 !border-2 !border-node-bg"
|
|
141
|
+
/>
|
|
142
|
+
{data.hasCatch && (
|
|
143
|
+
<Handle
|
|
144
|
+
type="source"
|
|
145
|
+
position={Position.Bottom}
|
|
146
|
+
id="catch"
|
|
147
|
+
style={{ left: '50%' }}
|
|
148
|
+
className="!w-2.5 !h-2.5 !bg-red-500 !border-2 !border-node-bg"
|
|
149
|
+
/>
|
|
150
|
+
)}
|
|
151
|
+
{data.hasFinally && (
|
|
152
|
+
<Handle
|
|
153
|
+
type="source"
|
|
154
|
+
position={Position.Bottom}
|
|
155
|
+
id="finally"
|
|
156
|
+
style={{ left: '75%' }}
|
|
157
|
+
className="!w-2.5 !h-2.5 !bg-purple-500 !border-2 !border-node-bg"
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export const TryCatchNode = memo(TryCatchNodeComponent);
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { Handle, Position, type Node, type NodeProps } from '@xyflow/react';
|
|
3
|
+
import { RotateCw, CheckCircle, XCircle, Clock } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
export interface WhileNodeData extends Record<string, unknown> {
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
condition: string;
|
|
9
|
+
maxIterations?: number;
|
|
10
|
+
status?: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
11
|
+
currentIteration?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type WhileNodeType = Node<WhileNodeData, 'while'>;
|
|
15
|
+
|
|
16
|
+
function WhileNodeComponent({ data, selected }: NodeProps<WhileNodeType>) {
|
|
17
|
+
const statusConfig: Record<
|
|
18
|
+
NonNullable<WhileNodeData['status']>,
|
|
19
|
+
{ icon: typeof Clock; color: string; bgColor: string; animate?: boolean }
|
|
20
|
+
> = {
|
|
21
|
+
pending: { icon: Clock, color: 'text-gray-400', bgColor: 'bg-gray-400/10' },
|
|
22
|
+
running: {
|
|
23
|
+
icon: RotateCw,
|
|
24
|
+
color: 'text-orange-400',
|
|
25
|
+
bgColor: 'bg-orange-400/10',
|
|
26
|
+
animate: true,
|
|
27
|
+
},
|
|
28
|
+
completed: {
|
|
29
|
+
icon: CheckCircle,
|
|
30
|
+
color: 'text-success',
|
|
31
|
+
bgColor: 'bg-success/10',
|
|
32
|
+
},
|
|
33
|
+
failed: { icon: XCircle, color: 'text-error', bgColor: 'bg-error/10' },
|
|
34
|
+
skipped: {
|
|
35
|
+
icon: XCircle,
|
|
36
|
+
color: 'text-gray-500',
|
|
37
|
+
bgColor: 'bg-gray-500/10',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const status = data.status || 'pending';
|
|
42
|
+
const config = statusConfig[status];
|
|
43
|
+
const StatusIcon = config.icon;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
className={`control-flow-node while-node p-0 ${selected ? 'selected' : ''} ${status === 'running' ? 'running' : ''}`}
|
|
48
|
+
style={{
|
|
49
|
+
background: 'linear-gradient(135deg, #fb923c 0%, #f97316 100%)',
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{/* Input handle */}
|
|
53
|
+
<Handle
|
|
54
|
+
type="target"
|
|
55
|
+
position={Position.Top}
|
|
56
|
+
className="!w-3 !h-3 !bg-primary !border-2 !border-node-bg"
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
{/* Node header */}
|
|
60
|
+
<div className="flex items-center gap-3 p-3 border-b border-white/20">
|
|
61
|
+
<div className="w-8 h-8 rounded-lg bg-white/20 flex items-center justify-center">
|
|
62
|
+
<RotateCw className="w-5 h-5 text-white" />
|
|
63
|
+
</div>
|
|
64
|
+
<div className="flex-1 min-w-0">
|
|
65
|
+
<div className="text-sm font-medium text-white">
|
|
66
|
+
{data.name || 'While'}
|
|
67
|
+
</div>
|
|
68
|
+
<div className="text-xs text-white/70">Loop</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div
|
|
71
|
+
className={`w-6 h-6 rounded-full ${config.bgColor} flex items-center justify-center`}
|
|
72
|
+
>
|
|
73
|
+
<StatusIcon
|
|
74
|
+
className={`w-4 h-4 ${config.color} ${config.animate ? 'animate-pulse' : ''}`}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
{/* Node body */}
|
|
80
|
+
<div className="p-3 bg-white/10">
|
|
81
|
+
<div className="text-xs text-white/90 mb-3">
|
|
82
|
+
<span className="text-white/60">Condition:</span>{' '}
|
|
83
|
+
<span className="font-mono">{data.condition || 'Not set'}</span>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
{/* Max iterations */}
|
|
87
|
+
<div className="text-xs text-white/90 mb-3">
|
|
88
|
+
<span className="text-white/60">Max Iterations:</span>{' '}
|
|
89
|
+
<span className="font-medium">{data.maxIterations || 100}</span>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
{/* Current iteration counter */}
|
|
93
|
+
{data.currentIteration !== undefined && (
|
|
94
|
+
<div className="mt-2 p-2 bg-white/5 rounded">
|
|
95
|
+
<div className="flex items-center justify-between mb-1">
|
|
96
|
+
<span className="text-xs text-white/70">Iterations</span>
|
|
97
|
+
<span className="text-xs text-white font-medium">
|
|
98
|
+
{data.currentIteration} / {data.maxIterations || 100}
|
|
99
|
+
</span>
|
|
100
|
+
</div>
|
|
101
|
+
<div className="w-full bg-white/10 rounded-full h-1.5">
|
|
102
|
+
<div
|
|
103
|
+
className="bg-orange-400 h-1.5 rounded-full transition-all"
|
|
104
|
+
style={{
|
|
105
|
+
width: `${(data.currentIteration / (data.maxIterations || 100)) * 100}%`,
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
|
|
112
|
+
{/* Loop metadata */}
|
|
113
|
+
<div className="mt-3 text-xs text-white/50 flex items-center gap-2">
|
|
114
|
+
<span>⚠️</span>
|
|
115
|
+
<span>Exits when condition becomes false</span>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
{/* Output handle */}
|
|
120
|
+
<Handle
|
|
121
|
+
type="source"
|
|
122
|
+
position={Position.Bottom}
|
|
123
|
+
className="!w-3 !h-3 !bg-primary !border-2 !border-node-bg"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const WhileNode = memo(WhileNodeComponent);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Export all canvas components
|
|
2
|
+
export { Canvas } from './Canvas';
|
|
3
|
+
export { StepNode } from './StepNode';
|
|
4
|
+
export { SubWorkflowNode } from './SubWorkflowNode';
|
|
5
|
+
export { TriggerNode } from './TriggerNode';
|
|
6
|
+
export { OutputNode } from './OutputNode';
|
|
7
|
+
|
|
8
|
+
// Control flow nodes
|
|
9
|
+
export { IfElseNode } from './IfElseNode';
|
|
10
|
+
export { ForEachNode } from './ForEachNode';
|
|
11
|
+
export { WhileNode } from './WhileNode';
|
|
12
|
+
export { SwitchNode } from './SwitchNode';
|
|
13
|
+
export { ParallelNode } from './ParallelNode';
|
|
14
|
+
export { TryCatchNode } from './TryCatchNode';
|
|
15
|
+
export { TransformNode } from './TransformNode';
|
|
16
|
+
|
|
17
|
+
// Export types
|
|
18
|
+
export type { IfElseNodeData, IfElseNodeType } from './IfElseNode';
|
|
19
|
+
export type { ForEachNodeData, ForEachNodeType } from './ForEachNode';
|
|
20
|
+
export type { WhileNodeData, WhileNodeType } from './WhileNode';
|
|
21
|
+
export type { SwitchNodeData, SwitchNodeType } from './SwitchNode';
|
|
22
|
+
export type { ParallelNodeData, ParallelNodeType } from './ParallelNode';
|
|
23
|
+
export type { TryCatchNodeData, TryCatchNodeType } from './TryCatchNode';
|
|
24
|
+
export type { TransformNodeData, TransformNodeType } from './TransformNode';
|
|
@@ -12,6 +12,15 @@ import {
|
|
|
12
12
|
Bot,
|
|
13
13
|
Zap,
|
|
14
14
|
HelpCircle,
|
|
15
|
+
Phone,
|
|
16
|
+
Send,
|
|
17
|
+
ShoppingCart,
|
|
18
|
+
Headphones,
|
|
19
|
+
Users,
|
|
20
|
+
CheckSquare,
|
|
21
|
+
Cloud,
|
|
22
|
+
HardDrive,
|
|
23
|
+
CreditCard,
|
|
15
24
|
} from 'lucide-react';
|
|
16
25
|
|
|
17
26
|
type IconComponent = React.ComponentType<{ className?: string }>;
|
|
@@ -34,6 +43,18 @@ const serviceIcons: Record<string, IconComponent> = {
|
|
|
34
43
|
webhook: Zap,
|
|
35
44
|
schedule: Calendar,
|
|
36
45
|
trigger: Zap,
|
|
46
|
+
stripe: CreditCard,
|
|
47
|
+
teams: Users,
|
|
48
|
+
twilio: Phone,
|
|
49
|
+
sendgrid: Send,
|
|
50
|
+
shopify: ShoppingCart,
|
|
51
|
+
zendesk: Headphones,
|
|
52
|
+
mailchimp: Mail,
|
|
53
|
+
asana: CheckSquare,
|
|
54
|
+
trello: Trello,
|
|
55
|
+
dropbox: Cloud,
|
|
56
|
+
's3': HardDrive,
|
|
57
|
+
'aws-s3': HardDrive,
|
|
37
58
|
};
|
|
38
59
|
|
|
39
60
|
export function getServiceIcon(serviceName: string): IconComponent {
|
|
@@ -57,6 +78,18 @@ export function getServiceColor(serviceName: string): string {
|
|
|
57
78
|
claude: '#CC785C',
|
|
58
79
|
opencode: '#00A67E',
|
|
59
80
|
ollama: '#1a1a2e',
|
|
81
|
+
stripe: '#635BFF',
|
|
82
|
+
teams: '#6264A7',
|
|
83
|
+
twilio: '#F22F46',
|
|
84
|
+
sendgrid: '#1A82E2',
|
|
85
|
+
shopify: '#96BF48',
|
|
86
|
+
zendesk: '#03363D',
|
|
87
|
+
mailchimp: '#FFE01B',
|
|
88
|
+
asana: '#F06A6A',
|
|
89
|
+
trello: '#0079BF',
|
|
90
|
+
dropbox: '#0061FF',
|
|
91
|
+
's3': '#FF9900',
|
|
92
|
+
'aws-s3': '#FF9900',
|
|
60
93
|
};
|
|
61
94
|
|
|
62
95
|
const normalizedName = serviceName.toLowerCase().split('.')[0];
|
package/src/server/index.ts
CHANGED
|
@@ -51,7 +51,7 @@ export async function startServer(options: ServerOptions = {}): Promise<Server>
|
|
|
51
51
|
|
|
52
52
|
// Health check
|
|
53
53
|
app.get('/api/health', (_req, res) => {
|
|
54
|
-
res.json({ status: 'ok', version: '2.0.0-alpha.
|
|
54
|
+
res.json({ status: 'ok', version: '2.0.0-alpha.2' });
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
// Serve static files if static dir is provided
|