@marktoflow/gui 2.0.0-alpha.12 → 2.0.0-alpha.13
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/package.json +1 -3
- package/.marktoflow/state/workflow-state.db +0 -0
- package/.marktoflow/state/workflow-state.db-shm +0 -0
- package/.marktoflow/state/workflow-state.db-wal +0 -0
- package/.turbo/turbo-build.log +0 -42
- package/.turbo/turbo-test.log +0 -38
- package/marktoflow-gui-2.0.0-alpha.12.tgz +0 -0
- package/playwright.config.ts +0 -27
- package/postcss.config.js +0 -6
- package/src/client/App.tsx +0 -520
- package/src/client/components/Canvas/Canvas.tsx +0 -425
- package/src/client/components/Canvas/ExecutionOverlay.tsx +0 -935
- package/src/client/components/Canvas/ForEachNode.tsx +0 -152
- package/src/client/components/Canvas/IfElseNode.tsx +0 -141
- package/src/client/components/Canvas/NodeContextMenu.tsx +0 -192
- package/src/client/components/Canvas/OutputNode.tsx +0 -111
- package/src/client/components/Canvas/ParallelNode.tsx +0 -157
- package/src/client/components/Canvas/StepNode.tsx +0 -106
- package/src/client/components/Canvas/SubWorkflowNode.tsx +0 -141
- package/src/client/components/Canvas/SwitchNode.tsx +0 -185
- package/src/client/components/Canvas/Toolbar.tsx +0 -227
- package/src/client/components/Canvas/TransformNode.tsx +0 -194
- package/src/client/components/Canvas/TriggerNode.tsx +0 -128
- package/src/client/components/Canvas/TryCatchNode.tsx +0 -164
- package/src/client/components/Canvas/WhileNode.tsx +0 -161
- package/src/client/components/Canvas/index.ts +0 -24
- package/src/client/components/Debug/VariableInspector.tsx +0 -148
- package/src/client/components/Editor/InputsEditor.tsx +0 -458
- package/src/client/components/Editor/NewStepWizard.tsx +0 -344
- package/src/client/components/Editor/StepEditor.tsx +0 -532
- package/src/client/components/Editor/YamlEditor.tsx +0 -160
- package/src/client/components/Panels/PropertiesPanel.tsx +0 -589
- package/src/client/components/Prompt/ChangePreview.tsx +0 -281
- package/src/client/components/Prompt/PromptHistoryPanel.tsx +0 -209
- package/src/client/components/Prompt/PromptInput.tsx +0 -110
- package/src/client/components/Settings/ProviderSwitcher.tsx +0 -228
- package/src/client/components/Sidebar/ImportDialog.tsx +0 -257
- package/src/client/components/Sidebar/Sidebar.tsx +0 -362
- package/src/client/components/common/Breadcrumb.tsx +0 -40
- package/src/client/components/common/Button.tsx +0 -68
- package/src/client/components/common/ContextMenu.tsx +0 -202
- package/src/client/components/common/KeyboardShortcuts.tsx +0 -149
- package/src/client/components/common/Modal.tsx +0 -93
- package/src/client/components/common/Tabs.tsx +0 -57
- package/src/client/components/common/ThemeToggle.tsx +0 -63
- package/src/client/components/index.ts +0 -32
- package/src/client/hooks/index.ts +0 -4
- package/src/client/hooks/useAIPrompt.ts +0 -108
- package/src/client/hooks/useCanvas.ts +0 -247
- package/src/client/hooks/useWebSocket.ts +0 -164
- package/src/client/hooks/useWorkflow.ts +0 -138
- package/src/client/main.tsx +0 -10
- package/src/client/stores/agentStore.ts +0 -109
- package/src/client/stores/canvasStore.ts +0 -348
- package/src/client/stores/editorStore.ts +0 -133
- package/src/client/stores/executionStore.ts +0 -502
- package/src/client/stores/index.ts +0 -4
- package/src/client/stores/layoutStore.ts +0 -103
- package/src/client/stores/navigationStore.ts +0 -49
- package/src/client/stores/promptStore.ts +0 -113
- package/src/client/stores/themeStore.ts +0 -75
- package/src/client/stores/workflowStore.ts +0 -185
- package/src/client/styles/globals.css +0 -452
- package/src/client/utils/cn.ts +0 -9
- package/src/client/utils/index.ts +0 -4
- package/src/client/utils/platform.ts +0 -46
- package/src/client/utils/serviceIcons.tsx +0 -97
- package/src/client/utils/stepValidation.ts +0 -155
- package/src/client/utils/workflowToGraph.ts +0 -523
- package/src/server/index.ts +0 -137
- package/src/server/routes/ai.ts +0 -91
- package/src/server/routes/execute.ts +0 -71
- package/src/server/routes/executions.ts +0 -136
- package/src/server/routes/tools.ts +0 -970
- package/src/server/routes/workflows.ts +0 -147
- package/src/server/services/AIService.ts +0 -105
- package/src/server/services/FileWatcher.ts +0 -69
- package/src/server/services/WorkflowService.ts +0 -601
- package/src/server/services/agents/claude-code-provider.ts +0 -320
- package/src/server/services/agents/claude-provider.ts +0 -248
- package/src/server/services/agents/codex-provider.ts +0 -398
- package/src/server/services/agents/copilot-provider.ts +0 -311
- package/src/server/services/agents/demo-provider.ts +0 -184
- package/src/server/services/agents/index.ts +0 -31
- package/src/server/services/agents/ollama-provider.ts +0 -267
- package/src/server/services/agents/prompts.ts +0 -509
- package/src/server/services/agents/registry.ts +0 -310
- package/src/server/services/agents/types.ts +0 -146
- package/src/server/websocket/index.ts +0 -117
- package/src/shared/constants.ts +0 -180
- package/src/shared/types.ts +0 -179
- package/tailwind.config.ts +0 -73
- package/tests/e2e/app.spec.ts +0 -90
- package/tests/e2e/canvas.spec.ts +0 -128
- package/tests/e2e/workflow.spec.ts +0 -185
- package/tests/integration/api.test.ts +0 -452
- package/tests/integration/testApp.ts +0 -31
- package/tests/setup.ts +0 -72
- package/tests/unit/ForEachNode.test.tsx +0 -308
- package/tests/unit/IfElseNode.test.tsx +0 -235
- package/tests/unit/ParallelNode.test.tsx +0 -344
- package/tests/unit/SwitchNode.test.tsx +0 -327
- package/tests/unit/TransformNode.test.tsx +0 -386
- package/tests/unit/TryCatchNode.test.tsx +0 -243
- package/tests/unit/WhileNode.test.tsx +0 -230
- package/tests/unit/agentStore.test.ts +0 -218
- package/tests/unit/canvasStore.test.ts +0 -502
- package/tests/unit/codexProvider.test.ts +0 -399
- package/tests/unit/components.test.tsx +0 -151
- package/tests/unit/executionStore.test.ts +0 -567
- package/tests/unit/layoutStore.test.ts +0 -194
- package/tests/unit/navigationStore.test.ts +0 -152
- package/tests/unit/platform.test.ts +0 -118
- package/tests/unit/serviceIcons.test.ts +0 -197
- package/tests/unit/stepValidation.test.ts +0 -226
- package/tests/unit/themeStore.test.ts +0 -141
- package/tests/unit/workflowToGraph.test.ts +0 -311
- package/tsconfig.json +0 -29
- package/tsconfig.server.json +0 -28
- package/vite.config.ts +0 -31
- package/vitest.config.ts +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marktoflow/gui",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"description": "Visual workflow designer for marktoflow - web UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/server/index.js",
|
|
@@ -56,8 +56,6 @@
|
|
|
56
56
|
"express": "^4.21.2",
|
|
57
57
|
"lucide-react": "^0.468.0",
|
|
58
58
|
"multer": "^2.0.2",
|
|
59
|
-
"react": "^18.3.1",
|
|
60
|
-
"react-dom": "^18.3.1",
|
|
61
59
|
"react-markdown": "^9.0.1",
|
|
62
60
|
"rehype-highlight": "^7.0.1",
|
|
63
61
|
"remark-gfm": "^4.0.0",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @marktoflow/gui@2.0.0-alpha.12 build /Volumes/USBEXT/sandbox/personal/marktoflow/packages/gui
|
|
3
|
-
> pnpm build:client && pnpm build:server && pnpm build:flatten
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
> @marktoflow/gui@2.0.0-alpha.12 build:client /Volumes/USBEXT/sandbox/personal/marktoflow/packages/gui
|
|
7
|
-
> vite build
|
|
8
|
-
|
|
9
|
-
vite v6.4.1 building for production...
|
|
10
|
-
transforming...
|
|
11
|
-
✓ 2270 modules transformed.
|
|
12
|
-
rendering chunks...
|
|
13
|
-
computing gzip size...
|
|
14
|
-
dist/client/index.html 0.83 kB │ gzip: 0.46 kB
|
|
15
|
-
dist/client/assets/index-Dru63gi6.css 51.25 kB │ gzip: 9.52 kB
|
|
16
|
-
dist/client/assets/index-CM44OayM.js 881.84 kB │ gzip: 268.82 kB │ map: 3,510.67 kB
|
|
17
|
-
|
|
18
|
-
(!) Some chunks are larger than 500 kB after minification. Consider:
|
|
19
|
-
- Using dynamic import() to code-split the application
|
|
20
|
-
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
|
|
21
|
-
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
|
|
22
|
-
✓ built in 2.21s
|
|
23
|
-
|
|
24
|
-
> @marktoflow/gui@2.0.0-alpha.12 build:server /Volumes/USBEXT/sandbox/personal/marktoflow/packages/gui
|
|
25
|
-
> tsc -p tsconfig.server.json
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
> @marktoflow/gui@2.0.0-alpha.12 build:flatten /Volumes/USBEXT/sandbox/personal/marktoflow/packages/gui
|
|
29
|
-
> node scripts/flatten-dist.js
|
|
30
|
-
|
|
31
|
-
🔧 Flattening dist structure...
|
|
32
|
-
📦 Moving server/server/* to temp location...
|
|
33
|
-
📦 Moving server/shared/* to dist/shared/...
|
|
34
|
-
🗑️ Removing old server directory...
|
|
35
|
-
📦 Moving temp back to dist/server/...
|
|
36
|
-
✅ Dist structure flattened successfully!
|
|
37
|
-
|
|
38
|
-
Final structure:
|
|
39
|
-
dist/
|
|
40
|
-
client/ - React app
|
|
41
|
-
server/ - Server code (flat)
|
|
42
|
-
shared/ - Shared code
|
package/.turbo/turbo-test.log
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @marktoflow/gui@2.0.0-alpha.12 test /Volumes/USBEXT/sandbox/personal/marktoflow/packages/gui
|
|
3
|
-
> vitest run
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
RUN v2.1.9 /Volumes/USBEXT/sandbox/personal/marktoflow/packages/gui
|
|
7
|
-
|
|
8
|
-
✓ tests/unit/executionStore.test.ts (46 tests) 117ms
|
|
9
|
-
✓ tests/unit/workflowToGraph.test.ts (16 tests) 4ms
|
|
10
|
-
✓ tests/unit/canvasStore.test.ts (24 tests) 18ms
|
|
11
|
-
✓ tests/unit/codexProvider.test.ts (42 tests) 31ms
|
|
12
|
-
✓ tests/unit/ParallelNode.test.tsx (30 tests) 1015ms
|
|
13
|
-
✓ ParallelNode > visual styling > should have blue/cyan gradient background 429ms
|
|
14
|
-
✓ tests/unit/TransformNode.test.tsx (34 tests) 994ms
|
|
15
|
-
✓ TransformNode > visual styling > should have teal/cyan gradient background 342ms
|
|
16
|
-
✓ tests/unit/SwitchNode.test.tsx (28 tests) 1047ms
|
|
17
|
-
✓ SwitchNode > visual styling > should have purple/magenta gradient background 311ms
|
|
18
|
-
✓ tests/unit/ForEachNode.test.tsx (28 tests) 1024ms
|
|
19
|
-
✓ ForEachNode > visual styling > should have pink/red gradient background 313ms
|
|
20
|
-
✓ tests/unit/stepValidation.test.ts (17 tests) 6ms
|
|
21
|
-
✓ tests/integration/api.test.ts (37 tests) 414ms
|
|
22
|
-
✓ tests/unit/TryCatchNode.test.tsx (25 tests) 647ms
|
|
23
|
-
✓ tests/unit/IfElseNode.test.tsx (23 tests) 690ms
|
|
24
|
-
✓ IfElseNode > should render node with name and condition 322ms
|
|
25
|
-
✓ tests/unit/agentStore.test.ts (9 tests) 7ms
|
|
26
|
-
✓ tests/unit/WhileNode.test.tsx (21 tests) 467ms
|
|
27
|
-
✓ tests/unit/layoutStore.test.ts (18 tests) 5ms
|
|
28
|
-
✓ tests/unit/navigationStore.test.ts (10 tests) 6ms
|
|
29
|
-
✓ tests/unit/serviceIcons.test.ts (12 tests) 3ms
|
|
30
|
-
✓ tests/unit/themeStore.test.ts (9 tests) 5ms
|
|
31
|
-
✓ tests/unit/components.test.tsx (14 tests) 84ms
|
|
32
|
-
✓ tests/unit/platform.test.ts (13 tests) 4ms
|
|
33
|
-
|
|
34
|
-
Test Files 20 passed (20)
|
|
35
|
-
Tests 456 passed (456)
|
|
36
|
-
Start at 16:31:41
|
|
37
|
-
Duration 6.57s (transform 1.40s, setup 2.53s, collect 8.74s, tests 6.59s, environment 21.72s, prepare 2.61s)
|
|
38
|
-
|
|
Binary file
|
package/playwright.config.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { defineConfig, devices } from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
testDir: './tests/e2e',
|
|
5
|
-
fullyParallel: true,
|
|
6
|
-
forbidOnly: !!process.env.CI,
|
|
7
|
-
retries: process.env.CI ? 2 : 0,
|
|
8
|
-
workers: process.env.CI ? 1 : undefined,
|
|
9
|
-
reporter: 'html',
|
|
10
|
-
use: {
|
|
11
|
-
baseURL: 'http://localhost:5173',
|
|
12
|
-
trace: 'on-first-retry',
|
|
13
|
-
screenshot: 'only-on-failure',
|
|
14
|
-
},
|
|
15
|
-
projects: [
|
|
16
|
-
{
|
|
17
|
-
name: 'chromium',
|
|
18
|
-
use: { ...devices['Desktop Chrome'] },
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
webServer: {
|
|
22
|
-
command: 'pnpm dev',
|
|
23
|
-
url: 'http://localhost:5173',
|
|
24
|
-
reuseExistingServer: !process.env.CI,
|
|
25
|
-
timeout: 120000,
|
|
26
|
-
},
|
|
27
|
-
});
|
package/postcss.config.js
DELETED
package/src/client/App.tsx
DELETED
|
@@ -1,520 +0,0 @@
|
|
|
1
|
-
import { useEffect, useCallback, useState, useRef } from 'react';
|
|
2
|
-
import { ReactFlowProvider } from '@xyflow/react';
|
|
3
|
-
import { Menu, PanelRight, X } from 'lucide-react';
|
|
4
|
-
import { Canvas } from './components/Canvas/Canvas';
|
|
5
|
-
import { Toolbar } from './components/Canvas/Toolbar';
|
|
6
|
-
import { ExecutionOverlay } from './components/Canvas/ExecutionOverlay';
|
|
7
|
-
import { Sidebar } from './components/Sidebar/Sidebar';
|
|
8
|
-
import { PropertiesPanel } from './components/Panels/PropertiesPanel';
|
|
9
|
-
import { PromptInput } from './components/Prompt/PromptInput';
|
|
10
|
-
import { ChangePreview } from './components/Prompt/ChangePreview';
|
|
11
|
-
import { NewStepWizard } from './components/Editor/NewStepWizard';
|
|
12
|
-
import {
|
|
13
|
-
KeyboardShortcuts,
|
|
14
|
-
KeyboardShortcutsButton,
|
|
15
|
-
useKeyboardShortcuts,
|
|
16
|
-
} from './components/common/KeyboardShortcuts';
|
|
17
|
-
import { ThemeToggle } from './components/common/ThemeToggle';
|
|
18
|
-
import { Breadcrumb, type BreadcrumbItem } from './components/common/Breadcrumb';
|
|
19
|
-
import { useWorkflow } from './hooks/useWorkflow';
|
|
20
|
-
import { useWebSocket } from './hooks/useWebSocket';
|
|
21
|
-
import { usePromptStore } from './stores/promptStore';
|
|
22
|
-
import { useEditorStore } from './stores/editorStore';
|
|
23
|
-
import { useNavigationStore } from './stores/navigationStore';
|
|
24
|
-
import { useWorkflowStore } from './stores/workflowStore';
|
|
25
|
-
import { useExecutionStore } from './stores/executionStore';
|
|
26
|
-
import { useLayoutStore, getBreakpoint } from './stores/layoutStore';
|
|
27
|
-
import type { WorkflowStep, StepStatus, WorkflowStatus } from '@shared/types';
|
|
28
|
-
|
|
29
|
-
export default function App() {
|
|
30
|
-
// Workflow management
|
|
31
|
-
const {
|
|
32
|
-
currentWorkflow,
|
|
33
|
-
selectedWorkflow,
|
|
34
|
-
saveWorkflow,
|
|
35
|
-
refreshWorkflows,
|
|
36
|
-
} = useWorkflow();
|
|
37
|
-
|
|
38
|
-
// Editor state
|
|
39
|
-
const {
|
|
40
|
-
isNewStepOpen,
|
|
41
|
-
newStepPosition,
|
|
42
|
-
openNewStepWizard,
|
|
43
|
-
closeNewStepWizard,
|
|
44
|
-
} = useEditorStore();
|
|
45
|
-
|
|
46
|
-
// Prompt state
|
|
47
|
-
const { pendingChanges, acceptChanges, rejectChanges } = usePromptStore();
|
|
48
|
-
|
|
49
|
-
// Keyboard shortcuts
|
|
50
|
-
const { isOpen: isShortcutsOpen, setIsOpen: setShortcutsOpen, openShortcuts } = useKeyboardShortcuts();
|
|
51
|
-
|
|
52
|
-
// Navigation for sub-workflow drilling
|
|
53
|
-
const { breadcrumbs, popToIndex, resetNavigation } = useNavigationStore();
|
|
54
|
-
const { loadWorkflow } = useWorkflowStore();
|
|
55
|
-
|
|
56
|
-
// Handle breadcrumb navigation
|
|
57
|
-
const handleBreadcrumbNavigate = useCallback((item: BreadcrumbItem, index: number) => {
|
|
58
|
-
// Navigate to the clicked breadcrumb
|
|
59
|
-
popToIndex(index);
|
|
60
|
-
loadWorkflow(item.path || '');
|
|
61
|
-
}, [popToIndex, loadWorkflow]);
|
|
62
|
-
|
|
63
|
-
// WebSocket for real-time updates
|
|
64
|
-
const { connected } = useWebSocket({
|
|
65
|
-
onWorkflowUpdated: () => {
|
|
66
|
-
refreshWorkflows();
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// Execution store
|
|
71
|
-
const {
|
|
72
|
-
isExecuting,
|
|
73
|
-
isPaused,
|
|
74
|
-
currentRunId,
|
|
75
|
-
runs,
|
|
76
|
-
startExecution,
|
|
77
|
-
updateStepStatus,
|
|
78
|
-
completeExecution,
|
|
79
|
-
addLog,
|
|
80
|
-
pauseExecution,
|
|
81
|
-
resumeExecution,
|
|
82
|
-
cancelExecution,
|
|
83
|
-
// Debug methods
|
|
84
|
-
debug,
|
|
85
|
-
enableDebugMode,
|
|
86
|
-
disableDebugMode,
|
|
87
|
-
toggleBreakpoint,
|
|
88
|
-
clearAllBreakpoints,
|
|
89
|
-
stepOver,
|
|
90
|
-
stepInto,
|
|
91
|
-
stepOut,
|
|
92
|
-
addWatchExpression,
|
|
93
|
-
removeWatchExpression,
|
|
94
|
-
} = useExecutionStore();
|
|
95
|
-
|
|
96
|
-
// Layout store for responsive behavior
|
|
97
|
-
const {
|
|
98
|
-
breakpoint,
|
|
99
|
-
setBreakpoint,
|
|
100
|
-
sidebarOpen,
|
|
101
|
-
setSidebarOpen,
|
|
102
|
-
propertiesPanelOpen,
|
|
103
|
-
setPropertiesPanelOpen,
|
|
104
|
-
} = useLayoutStore();
|
|
105
|
-
|
|
106
|
-
// Breakpoint detection on resize
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
const handleResize = () => {
|
|
109
|
-
const newBreakpoint = getBreakpoint(window.innerWidth);
|
|
110
|
-
if (newBreakpoint !== breakpoint) {
|
|
111
|
-
setBreakpoint(newBreakpoint);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// Set initial breakpoint
|
|
116
|
-
handleResize();
|
|
117
|
-
|
|
118
|
-
window.addEventListener('resize', handleResize);
|
|
119
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
120
|
-
}, [breakpoint, setBreakpoint]);
|
|
121
|
-
|
|
122
|
-
// Local execution state for overlay
|
|
123
|
-
const [workflowStatus, setWorkflowStatus] = useState<WorkflowStatus>('pending');
|
|
124
|
-
const [executionSteps, setExecutionSteps] = useState<Array<{
|
|
125
|
-
stepId: string;
|
|
126
|
-
stepName: string;
|
|
127
|
-
status: StepStatus;
|
|
128
|
-
duration?: number;
|
|
129
|
-
error?: string;
|
|
130
|
-
}>>([]);
|
|
131
|
-
const [executionLogs, setExecutionLogs] = useState<string[]>([]);
|
|
132
|
-
const [currentStepId, setCurrentStepId] = useState<string | null>(null);
|
|
133
|
-
const runIdRef = useRef<string | null>(null);
|
|
134
|
-
|
|
135
|
-
// Handle adding a new step
|
|
136
|
-
const handleAddStep = useCallback(() => {
|
|
137
|
-
openNewStepWizard();
|
|
138
|
-
}, [openNewStepWizard]);
|
|
139
|
-
|
|
140
|
-
// Handle step creation
|
|
141
|
-
const handleCreateStep = useCallback(
|
|
142
|
-
(step: WorkflowStep) => {
|
|
143
|
-
if (!currentWorkflow) return;
|
|
144
|
-
|
|
145
|
-
// Add step to workflow
|
|
146
|
-
const updatedWorkflow = {
|
|
147
|
-
...currentWorkflow,
|
|
148
|
-
steps: [...currentWorkflow.steps, step],
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
saveWorkflow(updatedWorkflow);
|
|
152
|
-
console.log('Created step:', step);
|
|
153
|
-
},
|
|
154
|
-
[currentWorkflow, saveWorkflow]
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
// Handle workflow execution
|
|
158
|
-
const handleExecute = useCallback(() => {
|
|
159
|
-
if (isExecuting) {
|
|
160
|
-
// Stop execution
|
|
161
|
-
if (runIdRef.current) {
|
|
162
|
-
cancelExecution(runIdRef.current);
|
|
163
|
-
}
|
|
164
|
-
setWorkflowStatus('cancelled');
|
|
165
|
-
setExecutionLogs((prev) => [...prev, 'Execution cancelled by user']);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (!currentWorkflow) return;
|
|
170
|
-
|
|
171
|
-
// Start execution - store in history
|
|
172
|
-
const workflowName = currentWorkflow.metadata?.name || 'Untitled Workflow';
|
|
173
|
-
const runId = startExecution(
|
|
174
|
-
selectedWorkflow || 'unknown',
|
|
175
|
-
workflowName
|
|
176
|
-
);
|
|
177
|
-
runIdRef.current = runId;
|
|
178
|
-
|
|
179
|
-
// Update local state for overlay
|
|
180
|
-
setWorkflowStatus('running');
|
|
181
|
-
setCurrentStepId(null);
|
|
182
|
-
setExecutionLogs(['Starting workflow execution...']);
|
|
183
|
-
|
|
184
|
-
// Initialize steps
|
|
185
|
-
setExecutionSteps(
|
|
186
|
-
currentWorkflow.steps.map((step) => ({
|
|
187
|
-
stepId: step.id,
|
|
188
|
-
stepName: step.name || step.id,
|
|
189
|
-
status: 'pending' as StepStatus,
|
|
190
|
-
}))
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
// Simulate execution (replace with actual execution via API)
|
|
194
|
-
simulateExecution(currentWorkflow.steps, runId);
|
|
195
|
-
}, [isExecuting, currentWorkflow, selectedWorkflow, startExecution, cancelExecution]);
|
|
196
|
-
|
|
197
|
-
// Simulate workflow execution
|
|
198
|
-
const simulateExecution = useCallback(
|
|
199
|
-
async (steps: WorkflowStep[], runId: string) => {
|
|
200
|
-
for (let i = 0; i < steps.length; i++) {
|
|
201
|
-
const step = steps[i];
|
|
202
|
-
const stepName = step.name || step.id;
|
|
203
|
-
|
|
204
|
-
// Update current step
|
|
205
|
-
setCurrentStepId(step.id);
|
|
206
|
-
setExecutionSteps((prev) =>
|
|
207
|
-
prev.map((s) =>
|
|
208
|
-
s.stepId === step.id ? { ...s, status: 'running' as StepStatus } : s
|
|
209
|
-
)
|
|
210
|
-
);
|
|
211
|
-
setExecutionLogs((prev) => [
|
|
212
|
-
...prev,
|
|
213
|
-
'Executing step: ' + stepName,
|
|
214
|
-
]);
|
|
215
|
-
|
|
216
|
-
// Update execution store
|
|
217
|
-
updateStepStatus(runId, step.id, 'running');
|
|
218
|
-
addLog(runId, 'Executing step: ' + stepName);
|
|
219
|
-
|
|
220
|
-
// Simulate step execution
|
|
221
|
-
await new Promise((resolve) => setTimeout(resolve, 1000 + Math.random() * 1000));
|
|
222
|
-
|
|
223
|
-
// Update step status
|
|
224
|
-
const success = Math.random() > 0.1; // 90% success rate
|
|
225
|
-
const duration = Math.floor(1000 + Math.random() * 1000);
|
|
226
|
-
const error = success ? undefined : 'Simulated error';
|
|
227
|
-
|
|
228
|
-
setExecutionSteps((prev) =>
|
|
229
|
-
prev.map((s) =>
|
|
230
|
-
s.stepId === step.id
|
|
231
|
-
? {
|
|
232
|
-
...s,
|
|
233
|
-
status: success ? ('completed' as StepStatus) : ('failed' as StepStatus),
|
|
234
|
-
duration,
|
|
235
|
-
error,
|
|
236
|
-
}
|
|
237
|
-
: s
|
|
238
|
-
)
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
const logMessage = success
|
|
242
|
-
? 'Step "' + stepName + '" completed'
|
|
243
|
-
: 'Step "' + stepName + '" failed';
|
|
244
|
-
setExecutionLogs((prev) => [...prev, logMessage]);
|
|
245
|
-
|
|
246
|
-
// Update execution store
|
|
247
|
-
updateStepStatus(runId, step.id, success ? 'completed' : 'failed', undefined, error);
|
|
248
|
-
addLog(runId, logMessage);
|
|
249
|
-
|
|
250
|
-
if (!success) {
|
|
251
|
-
setWorkflowStatus('failed');
|
|
252
|
-
completeExecution(runId, 'failed');
|
|
253
|
-
runIdRef.current = null;
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
setWorkflowStatus('completed');
|
|
259
|
-
setExecutionLogs((prev) => [...prev, 'Workflow completed successfully!']);
|
|
260
|
-
completeExecution(runId, 'completed');
|
|
261
|
-
runIdRef.current = null;
|
|
262
|
-
},
|
|
263
|
-
[updateStepStatus, addLog, completeExecution]
|
|
264
|
-
);
|
|
265
|
-
|
|
266
|
-
// Handle save
|
|
267
|
-
const handleSave = useCallback(() => {
|
|
268
|
-
if (currentWorkflow) {
|
|
269
|
-
saveWorkflow(currentWorkflow);
|
|
270
|
-
}
|
|
271
|
-
}, [currentWorkflow, saveWorkflow]);
|
|
272
|
-
|
|
273
|
-
// Handle navigating back to parent workflow
|
|
274
|
-
const handleNavigateBack = useCallback(() => {
|
|
275
|
-
if (breadcrumbs.length > 1) {
|
|
276
|
-
const parentIndex = breadcrumbs.length - 2;
|
|
277
|
-
const parentItem = breadcrumbs[parentIndex];
|
|
278
|
-
popToIndex(parentIndex);
|
|
279
|
-
loadWorkflow(parentItem.path);
|
|
280
|
-
}
|
|
281
|
-
}, [breadcrumbs, popToIndex, loadWorkflow]);
|
|
282
|
-
|
|
283
|
-
// Handle navigating to root workflow
|
|
284
|
-
const handleNavigateToRoot = useCallback(() => {
|
|
285
|
-
if (breadcrumbs.length > 1) {
|
|
286
|
-
const rootItem = breadcrumbs[0];
|
|
287
|
-
popToIndex(0);
|
|
288
|
-
loadWorkflow(rootItem.path);
|
|
289
|
-
}
|
|
290
|
-
}, [breadcrumbs, popToIndex, loadWorkflow]);
|
|
291
|
-
|
|
292
|
-
// Global keyboard shortcuts
|
|
293
|
-
useEffect(() => {
|
|
294
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
295
|
-
// Ignore if in an input/textarea
|
|
296
|
-
if (
|
|
297
|
-
e.target instanceof HTMLInputElement ||
|
|
298
|
-
e.target instanceof HTMLTextAreaElement
|
|
299
|
-
) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const isMeta = e.metaKey || e.ctrlKey;
|
|
304
|
-
|
|
305
|
-
// Cmd/Ctrl + S: Save
|
|
306
|
-
if (isMeta && e.key === 's') {
|
|
307
|
-
e.preventDefault();
|
|
308
|
-
handleSave();
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Cmd/Ctrl + Enter: Execute
|
|
312
|
-
if (isMeta && e.key === 'Enter') {
|
|
313
|
-
e.preventDefault();
|
|
314
|
-
handleExecute();
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// N: New step (when no modifier)
|
|
318
|
-
if (e.key === 'n' && !isMeta && !e.shiftKey && !e.altKey) {
|
|
319
|
-
e.preventDefault();
|
|
320
|
-
handleAddStep();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Cmd/Ctrl + Left Arrow: Navigate back to parent workflow
|
|
324
|
-
if (isMeta && e.key === 'ArrowLeft') {
|
|
325
|
-
e.preventDefault();
|
|
326
|
-
handleNavigateBack();
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Cmd/Ctrl + Up Arrow: Navigate to root workflow
|
|
330
|
-
if (isMeta && e.key === 'ArrowUp') {
|
|
331
|
-
e.preventDefault();
|
|
332
|
-
handleNavigateToRoot();
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// Debug keyboard shortcuts
|
|
336
|
-
// F9: Toggle debug mode
|
|
337
|
-
if (e.key === 'F9') {
|
|
338
|
-
e.preventDefault();
|
|
339
|
-
if (debug.enabled) {
|
|
340
|
-
disableDebugMode();
|
|
341
|
-
} else {
|
|
342
|
-
enableDebugMode();
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// F10: Step over (when paused in debug mode)
|
|
347
|
-
if (e.key === 'F10' && debug.enabled && isPaused) {
|
|
348
|
-
e.preventDefault();
|
|
349
|
-
stepOver();
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// F11: Step into (when paused in debug mode)
|
|
353
|
-
if (e.key === 'F11' && !e.shiftKey && debug.enabled && isPaused) {
|
|
354
|
-
e.preventDefault();
|
|
355
|
-
stepInto();
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// Shift+F11: Step out (when paused in debug mode)
|
|
359
|
-
if (e.key === 'F11' && e.shiftKey && debug.enabled && isPaused) {
|
|
360
|
-
e.preventDefault();
|
|
361
|
-
stepOut();
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// F5: Continue execution (when paused)
|
|
365
|
-
if (e.key === 'F5' && isPaused) {
|
|
366
|
-
e.preventDefault();
|
|
367
|
-
resumeExecution();
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
372
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
373
|
-
}, [handleSave, handleExecute, handleAddStep, handleNavigateBack, handleNavigateToRoot, debug.enabled, isPaused, enableDebugMode, disableDebugMode, stepOver, stepInto, stepOut, resumeExecution]);
|
|
374
|
-
|
|
375
|
-
return (
|
|
376
|
-
<ReactFlowProvider>
|
|
377
|
-
<div className="flex h-screen w-screen overflow-hidden bg-canvas-bg">
|
|
378
|
-
{/* Left Sidebar - Workflow List & Tools */}
|
|
379
|
-
<Sidebar />
|
|
380
|
-
|
|
381
|
-
{/* Main Canvas Area */}
|
|
382
|
-
<div className="flex flex-1 flex-col relative">
|
|
383
|
-
{/* Mobile Header */}
|
|
384
|
-
{breakpoint === 'mobile' && (
|
|
385
|
-
<div className="flex items-center justify-between p-3 border-b border-node-border bg-panel-bg">
|
|
386
|
-
<button
|
|
387
|
-
onClick={() => setSidebarOpen(true)}
|
|
388
|
-
className="w-10 h-10 rounded-lg flex items-center justify-center hover:bg-white/10 transition-colors"
|
|
389
|
-
aria-label="Open menu"
|
|
390
|
-
>
|
|
391
|
-
<Menu className="w-5 h-5 text-gray-400" />
|
|
392
|
-
</button>
|
|
393
|
-
<h1 className="text-sm font-medium text-white">Marktoflow</h1>
|
|
394
|
-
<button
|
|
395
|
-
onClick={() => setPropertiesPanelOpen(true)}
|
|
396
|
-
className="w-10 h-10 rounded-lg flex items-center justify-center hover:bg-white/10 transition-colors"
|
|
397
|
-
aria-label="Open properties"
|
|
398
|
-
>
|
|
399
|
-
<PanelRight className="w-5 h-5 text-gray-400" />
|
|
400
|
-
</button>
|
|
401
|
-
</div>
|
|
402
|
-
)}
|
|
403
|
-
|
|
404
|
-
{/* Desktop: Connection status, theme toggle & shortcuts */}
|
|
405
|
-
{breakpoint !== 'mobile' && (
|
|
406
|
-
<div className="absolute top-4 right-4 z-10 flex items-center gap-2">
|
|
407
|
-
<ThemeToggle showLabel />
|
|
408
|
-
<KeyboardShortcutsButton onClick={openShortcuts} />
|
|
409
|
-
<div
|
|
410
|
-
className={`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs ${
|
|
411
|
-
connected
|
|
412
|
-
? 'bg-success/10 text-success'
|
|
413
|
-
: 'bg-error/10 text-error'
|
|
414
|
-
}`}
|
|
415
|
-
>
|
|
416
|
-
<div
|
|
417
|
-
className={`w-2 h-2 rounded-full ${
|
|
418
|
-
connected ? 'bg-success' : 'bg-error'
|
|
419
|
-
}`}
|
|
420
|
-
/>
|
|
421
|
-
{connected ? 'Connected' : 'Disconnected'}
|
|
422
|
-
</div>
|
|
423
|
-
</div>
|
|
424
|
-
)}
|
|
425
|
-
|
|
426
|
-
{/* Toolbar */}
|
|
427
|
-
<Toolbar
|
|
428
|
-
onAddStep={handleAddStep}
|
|
429
|
-
onExecute={handleExecute}
|
|
430
|
-
onSave={handleSave}
|
|
431
|
-
isExecuting={isExecuting}
|
|
432
|
-
/>
|
|
433
|
-
|
|
434
|
-
{/* Breadcrumb for sub-workflow navigation */}
|
|
435
|
-
<Breadcrumb
|
|
436
|
-
items={breadcrumbs}
|
|
437
|
-
onNavigate={handleBreadcrumbNavigate}
|
|
438
|
-
/>
|
|
439
|
-
|
|
440
|
-
{/* Canvas */}
|
|
441
|
-
<div className="flex-1 relative">
|
|
442
|
-
<Canvas />
|
|
443
|
-
|
|
444
|
-
{/* Execution Overlay */}
|
|
445
|
-
<ExecutionOverlay
|
|
446
|
-
isExecuting={isExecuting}
|
|
447
|
-
isPaused={isPaused}
|
|
448
|
-
workflowStatus={workflowStatus}
|
|
449
|
-
currentStepId={currentStepId}
|
|
450
|
-
steps={executionSteps}
|
|
451
|
-
logs={executionLogs}
|
|
452
|
-
onPause={() => pauseExecution()}
|
|
453
|
-
onResume={() => resumeExecution()}
|
|
454
|
-
onStop={() => {
|
|
455
|
-
if (runIdRef.current) {
|
|
456
|
-
cancelExecution(runIdRef.current);
|
|
457
|
-
runIdRef.current = null;
|
|
458
|
-
}
|
|
459
|
-
setWorkflowStatus('cancelled');
|
|
460
|
-
}}
|
|
461
|
-
onStepOver={() => stepOver()}
|
|
462
|
-
onClose={() => {
|
|
463
|
-
setWorkflowStatus('pending');
|
|
464
|
-
setExecutionSteps([]);
|
|
465
|
-
setExecutionLogs([]);
|
|
466
|
-
}}
|
|
467
|
-
// Debug props
|
|
468
|
-
debug={debug}
|
|
469
|
-
onToggleDebugMode={() => {
|
|
470
|
-
if (debug.enabled) {
|
|
471
|
-
disableDebugMode();
|
|
472
|
-
} else {
|
|
473
|
-
enableDebugMode();
|
|
474
|
-
}
|
|
475
|
-
}}
|
|
476
|
-
onToggleBreakpoint={(stepId) => toggleBreakpoint(stepId)}
|
|
477
|
-
onStepInto={() => stepInto()}
|
|
478
|
-
onStepOut={() => stepOut()}
|
|
479
|
-
onClearBreakpoints={() => clearAllBreakpoints()}
|
|
480
|
-
onAddWatchExpression={(expr) => addWatchExpression(expr)}
|
|
481
|
-
onRemoveWatchExpression={(expr) => removeWatchExpression(expr)}
|
|
482
|
-
/>
|
|
483
|
-
</div>
|
|
484
|
-
|
|
485
|
-
{/* AI Prompt Input */}
|
|
486
|
-
<PromptInput />
|
|
487
|
-
</div>
|
|
488
|
-
|
|
489
|
-
{/* Right Panel - Properties */}
|
|
490
|
-
<PropertiesPanel />
|
|
491
|
-
|
|
492
|
-
{/* New Step Wizard */}
|
|
493
|
-
<NewStepWizard
|
|
494
|
-
open={isNewStepOpen}
|
|
495
|
-
onOpenChange={(open) => {
|
|
496
|
-
if (!open) closeNewStepWizard();
|
|
497
|
-
}}
|
|
498
|
-
onCreateStep={handleCreateStep}
|
|
499
|
-
position={newStepPosition || undefined}
|
|
500
|
-
/>
|
|
501
|
-
|
|
502
|
-
{/* Change Preview Modal */}
|
|
503
|
-
{pendingChanges && (
|
|
504
|
-
<ChangePreview
|
|
505
|
-
open={!!pendingChanges}
|
|
506
|
-
onOpenChange={() => rejectChanges()}
|
|
507
|
-
originalWorkflow={currentWorkflow}
|
|
508
|
-
modifiedWorkflow={pendingChanges}
|
|
509
|
-
explanation="AI has suggested the following changes to your workflow."
|
|
510
|
-
onAccept={acceptChanges}
|
|
511
|
-
onReject={rejectChanges}
|
|
512
|
-
/>
|
|
513
|
-
)}
|
|
514
|
-
|
|
515
|
-
{/* Keyboard Shortcuts Modal */}
|
|
516
|
-
<KeyboardShortcuts open={isShortcutsOpen} onOpenChange={setShortcutsOpen} />
|
|
517
|
-
</div>
|
|
518
|
-
</ReactFlowProvider>
|
|
519
|
-
);
|
|
520
|
-
}
|