machinaos 0.0.1 → 0.0.7
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/.env.template +71 -71
- package/LICENSE +21 -21
- package/README.md +163 -87
- package/bin/cli.js +62 -106
- package/client/.dockerignore +45 -45
- package/client/Dockerfile +68 -68
- package/client/dist/assets/index-DFSC53FP.css +1 -0
- package/client/dist/assets/index-fJ-1gTf5.js +613 -0
- package/client/dist/index.html +14 -0
- package/client/eslint.config.js +34 -16
- package/client/nginx.conf +66 -66
- package/client/package.json +61 -48
- package/client/src/App.tsx +27 -27
- package/client/src/Dashboard.tsx +1200 -1172
- package/client/src/ParameterPanel.tsx +302 -300
- package/client/src/components/AIAgentNode.tsx +315 -321
- package/client/src/components/APIKeyValidator.tsx +117 -117
- package/client/src/components/ClaudeChatModelNode.tsx +17 -17
- package/client/src/components/CredentialsModal.tsx +1200 -306
- package/client/src/components/GeminiChatModelNode.tsx +17 -17
- package/client/src/components/GenericNode.tsx +356 -356
- package/client/src/components/LocationParameterPanel.tsx +153 -153
- package/client/src/components/ModelNode.tsx +285 -285
- package/client/src/components/OpenAIChatModelNode.tsx +17 -17
- package/client/src/components/OutputPanel.tsx +470 -470
- package/client/src/components/ParameterRenderer.tsx +1873 -1873
- package/client/src/components/SkillEditorModal.tsx +3 -3
- package/client/src/components/SquareNode.tsx +812 -796
- package/client/src/components/ToolkitNode.tsx +365 -365
- package/client/src/components/auth/LoginPage.tsx +247 -247
- package/client/src/components/auth/ProtectedRoute.tsx +59 -59
- package/client/src/components/base/BaseChatModelNode.tsx +270 -270
- package/client/src/components/icons/AIProviderIcons.tsx +50 -50
- package/client/src/components/maps/GoogleMapsPicker.tsx +136 -136
- package/client/src/components/maps/MapsPreviewPanel.tsx +109 -109
- package/client/src/components/maps/index.ts +25 -25
- package/client/src/components/parameterPanel/InputSection.tsx +1094 -1094
- package/client/src/components/parameterPanel/LocationPanelLayout.tsx +64 -64
- package/client/src/components/parameterPanel/MapsSection.tsx +91 -91
- package/client/src/components/parameterPanel/MiddleSection.tsx +867 -571
- package/client/src/components/parameterPanel/OutputSection.tsx +80 -80
- package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +81 -81
- package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -436
- package/client/src/components/parameterPanel/index.ts +41 -41
- package/client/src/components/shared/DataPanel.tsx +142 -142
- package/client/src/components/shared/JSONTreeRenderer.tsx +105 -105
- package/client/src/components/ui/AIResultModal.tsx +203 -203
- package/client/src/components/ui/ApiKeyInput.tsx +93 -0
- package/client/src/components/ui/CodeEditor.tsx +81 -81
- package/client/src/components/ui/CollapsibleSection.tsx +87 -87
- package/client/src/components/ui/ComponentItem.tsx +153 -153
- package/client/src/components/ui/ComponentPalette.tsx +320 -320
- package/client/src/components/ui/ConsolePanel.tsx +151 -43
- package/client/src/components/ui/ErrorBoundary.tsx +195 -195
- package/client/src/components/ui/InputNodesPanel.tsx +203 -203
- package/client/src/components/ui/MapSelector.tsx +313 -313
- package/client/src/components/ui/Modal.tsx +151 -148
- package/client/src/components/ui/NodeOutputPanel.tsx +1150 -1150
- package/client/src/components/ui/OutputDisplayPanel.tsx +381 -381
- package/client/src/components/ui/QRCodeDisplay.tsx +182 -0
- package/client/src/components/ui/TopToolbar.tsx +736 -736
- package/client/src/components/ui/WorkflowSidebar.tsx +293 -293
- package/client/src/config/antdTheme.ts +186 -186
- package/client/src/contexts/AuthContext.tsx +221 -221
- package/client/src/contexts/ThemeContext.tsx +42 -42
- package/client/src/contexts/WebSocketContext.tsx +2144 -1971
- package/client/src/factories/baseChatModelFactory.ts +255 -255
- package/client/src/hooks/useAndroidOperations.ts +118 -164
- package/client/src/hooks/useApiKeyValidation.ts +106 -106
- package/client/src/hooks/useApiKeys.ts +238 -238
- package/client/src/hooks/useAppTheme.ts +17 -17
- package/client/src/hooks/useComponentPalette.ts +50 -50
- package/client/src/hooks/useDragAndDrop.ts +123 -123
- package/client/src/hooks/useDragVariable.ts +88 -88
- package/client/src/hooks/useExecution.ts +319 -313
- package/client/src/hooks/useParameterPanel.ts +176 -176
- package/client/src/hooks/useReactFlowNodes.ts +188 -188
- package/client/src/hooks/useToolSchema.ts +209 -209
- package/client/src/hooks/useWhatsApp.ts +196 -196
- package/client/src/hooks/useWorkflowManagement.ts +45 -45
- package/client/src/index.css +314 -314
- package/client/src/nodeDefinitions/aiAgentNodes.ts +335 -335
- package/client/src/nodeDefinitions/aiModelNodes.ts +340 -340
- package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -383
- package/client/src/nodeDefinitions/chatNodes.ts +135 -135
- package/client/src/nodeDefinitions/codeNodes.ts +54 -54
- package/client/src/nodeDefinitions/index.ts +14 -14
- package/client/src/nodeDefinitions/locationNodes.ts +462 -462
- package/client/src/nodeDefinitions/schedulerNodes.ts +220 -220
- package/client/src/nodeDefinitions/skillNodes.ts +17 -5
- package/client/src/nodeDefinitions/utilityNodes.ts +284 -284
- package/client/src/nodeDefinitions/whatsappNodes.ts +821 -865
- package/client/src/nodeDefinitions.ts +101 -103
- package/client/src/services/dynamicParameterService.ts +95 -95
- package/client/src/services/execution/aiAgentExecutionService.ts +34 -34
- package/client/src/services/executionService.ts +227 -231
- package/client/src/services/workflowApi.ts +91 -91
- package/client/src/store/useAppStore.ts +578 -581
- package/client/src/styles/theme.ts +513 -508
- package/client/src/styles/zIndex.ts +16 -16
- package/client/src/types/ComponentTypes.ts +38 -38
- package/client/src/types/INodeProperties.ts +287 -287
- package/client/src/types/NodeTypes.ts +27 -27
- package/client/src/utils/formatters.ts +32 -32
- package/client/src/utils/googleMapsLoader.ts +139 -139
- package/client/src/utils/locationUtils.ts +84 -84
- package/client/src/utils/nodeUtils.ts +30 -30
- package/client/src/utils/workflow.ts +29 -29
- package/client/src/vite-env.d.ts +12 -12
- package/client/tailwind.config.js +59 -59
- package/client/tsconfig.json +25 -25
- package/client/vite.config.js +35 -35
- package/install.ps1 +308 -0
- package/install.sh +343 -0
- package/package.json +81 -70
- package/scripts/build.js +174 -51
- package/scripts/clean.js +40 -40
- package/scripts/start.js +234 -210
- package/scripts/stop.js +301 -325
- package/server/.dockerignore +44 -44
- package/server/Dockerfile +45 -45
- package/server/constants.py +244 -249
- package/server/core/cache.py +460 -460
- package/server/core/config.py +127 -127
- package/server/core/container.py +98 -98
- package/server/core/database.py +1296 -1210
- package/server/core/logging.py +313 -313
- package/server/main.py +288 -288
- package/server/middleware/__init__.py +5 -5
- package/server/middleware/auth.py +89 -89
- package/server/models/auth.py +52 -52
- package/server/models/cache.py +24 -24
- package/server/models/database.py +235 -210
- package/server/models/nodes.py +435 -455
- package/server/pyproject.toml +75 -72
- package/server/requirements.txt +83 -83
- package/server/routers/android.py +294 -294
- package/server/routers/auth.py +203 -203
- package/server/routers/database.py +150 -150
- package/server/routers/maps.py +141 -141
- package/server/routers/nodejs_compat.py +288 -288
- package/server/routers/webhook.py +90 -90
- package/server/routers/websocket.py +2239 -2127
- package/server/routers/whatsapp.py +761 -761
- package/server/routers/workflow.py +199 -199
- package/server/services/ai.py +2444 -2414
- package/server/services/android_service.py +588 -588
- package/server/services/auth.py +130 -130
- package/server/services/chat_client.py +160 -160
- package/server/services/deployment/manager.py +706 -706
- package/server/services/event_waiter.py +675 -785
- package/server/services/execution/executor.py +1351 -1351
- package/server/services/execution/models.py +1 -1
- package/server/services/handlers/__init__.py +122 -126
- package/server/services/handlers/ai.py +390 -355
- package/server/services/handlers/android.py +69 -260
- package/server/services/handlers/code.py +278 -278
- package/server/services/handlers/http.py +193 -193
- package/server/services/handlers/tools.py +146 -32
- package/server/services/handlers/triggers.py +107 -107
- package/server/services/handlers/utility.py +822 -822
- package/server/services/handlers/whatsapp.py +423 -476
- package/server/services/maps.py +288 -288
- package/server/services/memory_store.py +103 -103
- package/server/services/node_executor.py +372 -375
- package/server/services/scheduler.py +155 -155
- package/server/services/skill_loader.py +1 -1
- package/server/services/status_broadcaster.py +834 -826
- package/server/services/temporal/__init__.py +23 -23
- package/server/services/temporal/activities.py +344 -344
- package/server/services/temporal/client.py +76 -76
- package/server/services/temporal/executor.py +147 -147
- package/server/services/temporal/worker.py +251 -251
- package/server/services/temporal/workflow.py +355 -355
- package/server/services/temporal/ws_client.py +236 -236
- package/server/services/text.py +110 -110
- package/server/services/user_auth.py +172 -172
- package/server/services/websocket_client.py +29 -29
- package/server/services/workflow.py +597 -597
- package/server/skills/android-skill/SKILL.md +4 -4
- package/server/skills/code-skill/SKILL.md +123 -89
- package/server/skills/maps-skill/SKILL.md +3 -3
- package/server/skills/memory-skill/SKILL.md +1 -1
- package/server/skills/web-search-skill/SKILL.md +154 -0
- package/server/skills/whatsapp-skill/SKILL.md +3 -3
- package/server/uv.lock +461 -100
- package/server/whatsapp-rpc/.dockerignore +30 -30
- package/server/whatsapp-rpc/Dockerfile +44 -44
- package/server/whatsapp-rpc/Dockerfile.web +17 -17
- package/server/whatsapp-rpc/README.md +139 -139
- package/server/whatsapp-rpc/bin/whatsapp-rpc-server +0 -0
- package/server/whatsapp-rpc/cli.js +95 -95
- package/server/whatsapp-rpc/configs/config.yaml +6 -6
- package/server/whatsapp-rpc/docker-compose.yml +35 -35
- package/server/whatsapp-rpc/docs/API.md +410 -410
- package/server/whatsapp-rpc/node_modules/.package-lock.json +259 -0
- package/server/whatsapp-rpc/node_modules/chalk/license +9 -0
- package/server/whatsapp-rpc/node_modules/chalk/package.json +83 -0
- package/server/whatsapp-rpc/node_modules/chalk/readme.md +297 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/index.d.ts +325 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/index.js +225 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/utilities.js +33 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/server/whatsapp-rpc/node_modules/commander/LICENSE +22 -0
- package/server/whatsapp-rpc/node_modules/commander/Readme.md +1148 -0
- package/server/whatsapp-rpc/node_modules/commander/esm.mjs +16 -0
- package/server/whatsapp-rpc/node_modules/commander/index.js +26 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/argument.js +145 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/command.js +2179 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/error.js +43 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/help.js +462 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/option.js +329 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/suggestSimilar.js +100 -0
- package/server/whatsapp-rpc/node_modules/commander/package-support.json +16 -0
- package/server/whatsapp-rpc/node_modules/commander/package.json +80 -0
- package/server/whatsapp-rpc/node_modules/commander/typings/esm.d.mts +3 -0
- package/server/whatsapp-rpc/node_modules/commander/typings/index.d.ts +884 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/README.md +89 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/index.js +39 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/parse.js +91 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/escape.js +47 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/package.json +73 -0
- package/server/whatsapp-rpc/node_modules/execa/index.d.ts +955 -0
- package/server/whatsapp-rpc/node_modules/execa/index.js +309 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/command.js +119 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/error.js +87 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/kill.js +102 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/pipe.js +42 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/promise.js +36 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/stdio.js +49 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/stream.js +133 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/verbose.js +19 -0
- package/server/whatsapp-rpc/node_modules/execa/license +9 -0
- package/server/whatsapp-rpc/node_modules/execa/package.json +90 -0
- package/server/whatsapp-rpc/node_modules/execa/readme.md +822 -0
- package/server/whatsapp-rpc/node_modules/get-stream/license +9 -0
- package/server/whatsapp-rpc/node_modules/get-stream/package.json +53 -0
- package/server/whatsapp-rpc/node_modules/get-stream/readme.md +291 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/array-buffer.js +84 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/array.js +32 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/buffer.js +20 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/contents.js +101 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/index.d.ts +119 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/index.js +5 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/string.js +36 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/utils.js +11 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/README.md +95 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/index.js +97 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/package.json +36 -0
- package/server/whatsapp-rpc/node_modules/human-signals/LICENSE +201 -0
- package/server/whatsapp-rpc/node_modules/human-signals/README.md +168 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/core.js +273 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.d.ts +73 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.js +70 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/realtime.js +16 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/signals.js +34 -0
- package/server/whatsapp-rpc/node_modules/human-signals/package.json +61 -0
- package/server/whatsapp-rpc/node_modules/is-stream/index.d.ts +81 -0
- package/server/whatsapp-rpc/node_modules/is-stream/index.js +29 -0
- package/server/whatsapp-rpc/node_modules/is-stream/license +9 -0
- package/server/whatsapp-rpc/node_modules/is-stream/package.json +44 -0
- package/server/whatsapp-rpc/node_modules/is-stream/readme.md +60 -0
- package/server/whatsapp-rpc/node_modules/isexe/LICENSE +15 -0
- package/server/whatsapp-rpc/node_modules/isexe/README.md +51 -0
- package/server/whatsapp-rpc/node_modules/isexe/index.js +57 -0
- package/server/whatsapp-rpc/node_modules/isexe/mode.js +41 -0
- package/server/whatsapp-rpc/node_modules/isexe/package.json +31 -0
- package/server/whatsapp-rpc/node_modules/isexe/test/basic.js +221 -0
- package/server/whatsapp-rpc/node_modules/isexe/windows.js +42 -0
- package/server/whatsapp-rpc/node_modules/kill-port/.editorconfig +12 -0
- package/server/whatsapp-rpc/node_modules/kill-port/.gitattributes +1 -0
- package/server/whatsapp-rpc/node_modules/kill-port/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/kill-port/README.md +140 -0
- package/server/whatsapp-rpc/node_modules/kill-port/cli.js +25 -0
- package/server/whatsapp-rpc/node_modules/kill-port/example.js +21 -0
- package/server/whatsapp-rpc/node_modules/kill-port/index.js +46 -0
- package/server/whatsapp-rpc/node_modules/kill-port/logo.png +0 -0
- package/server/whatsapp-rpc/node_modules/kill-port/package.json +41 -0
- package/server/whatsapp-rpc/node_modules/kill-port/pnpm-lock.yaml +4606 -0
- package/server/whatsapp-rpc/node_modules/kill-port/test.js +16 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/README.md +78 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/index.js +41 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/package.json +19 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/index.d.ts +52 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/index.js +71 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/license +9 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/package.json +45 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/readme.md +90 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/index.d.ts +90 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/index.js +52 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/license +9 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.d.ts +31 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.js +12 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/license +9 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/package.json +41 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/readme.md +57 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/package.json +49 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/readme.md +104 -0
- package/server/whatsapp-rpc/node_modules/onetime/index.d.ts +59 -0
- package/server/whatsapp-rpc/node_modules/onetime/index.js +41 -0
- package/server/whatsapp-rpc/node_modules/onetime/license +9 -0
- package/server/whatsapp-rpc/node_modules/onetime/package.json +45 -0
- package/server/whatsapp-rpc/node_modules/onetime/readme.md +94 -0
- package/server/whatsapp-rpc/node_modules/path-key/index.d.ts +40 -0
- package/server/whatsapp-rpc/node_modules/path-key/index.js +16 -0
- package/server/whatsapp-rpc/node_modules/path-key/license +9 -0
- package/server/whatsapp-rpc/node_modules/path-key/package.json +39 -0
- package/server/whatsapp-rpc/node_modules/path-key/readme.md +61 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/index.js +19 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/license +9 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/package.json +34 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/readme.md +34 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/index.d.ts +22 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/index.js +2 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/license +9 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/package.json +35 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/readme.md +33 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/README.md +60 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/index.js +47 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/package.json +29 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/LICENSE.txt +16 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/README.md +74 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js +10 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js +279 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/package.json +3 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js +42 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js +4 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js +275 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/package.json +3 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js +39 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/package.json +106 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/index.js +14 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/license +9 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/package.json +43 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/readme.md +35 -0
- package/server/whatsapp-rpc/node_modules/which/CHANGELOG.md +166 -0
- package/server/whatsapp-rpc/node_modules/which/LICENSE +15 -0
- package/server/whatsapp-rpc/node_modules/which/README.md +54 -0
- package/server/whatsapp-rpc/node_modules/which/bin/node-which +52 -0
- package/server/whatsapp-rpc/node_modules/which/package.json +43 -0
- package/server/whatsapp-rpc/node_modules/which/which.js +125 -0
- package/server/whatsapp-rpc/package-lock.json +272 -0
- package/server/whatsapp-rpc/package.json +30 -30
- package/server/whatsapp-rpc/schema.json +1294 -1294
- package/server/whatsapp-rpc/scripts/clean.cjs +66 -66
- package/server/whatsapp-rpc/scripts/cli.js +162 -162
- package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -166
- package/server/whatsapp-rpc/src/python/pyproject.toml +15 -15
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -4
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -427
- package/server/whatsapp-rpc/web/app.py +609 -609
- package/server/whatsapp-rpc/web/requirements.txt +6 -6
- package/server/whatsapp-rpc/web/rpc_client.py +427 -427
- package/server/whatsapp-rpc/web/static/openapi.yaml +59 -59
- package/server/whatsapp-rpc/web/templates/base.html +149 -149
- package/server/whatsapp-rpc/web/templates/contacts.html +240 -240
- package/server/whatsapp-rpc/web/templates/dashboard.html +319 -319
- package/server/whatsapp-rpc/web/templates/groups.html +328 -328
- package/server/whatsapp-rpc/web/templates/messages.html +465 -465
- package/server/whatsapp-rpc/web/templates/messaging.html +680 -680
- package/server/whatsapp-rpc/web/templates/send.html +258 -258
- package/server/whatsapp-rpc/web/templates/settings.html +459 -459
- package/client/src/components/ui/AndroidSettingsPanel.tsx +0 -401
- package/client/src/components/ui/WhatsAppSettingsPanel.tsx +0 -345
- package/client/src/nodeDefinitions/androidDeviceNodes.ts +0 -140
- package/docker-compose.prod.yml +0 -107
- package/docker-compose.yml +0 -104
- package/docs-MachinaOs/README.md +0 -85
- package/docs-MachinaOs/deployment/docker.mdx +0 -228
- package/docs-MachinaOs/deployment/production.mdx +0 -345
- package/docs-MachinaOs/docs.json +0 -75
- package/docs-MachinaOs/faq.mdx +0 -309
- package/docs-MachinaOs/favicon.svg +0 -5
- package/docs-MachinaOs/installation.mdx +0 -160
- package/docs-MachinaOs/introduction.mdx +0 -114
- package/docs-MachinaOs/logo/dark.svg +0 -6
- package/docs-MachinaOs/logo/light.svg +0 -6
- package/docs-MachinaOs/nodes/ai-agent.mdx +0 -216
- package/docs-MachinaOs/nodes/ai-models.mdx +0 -240
- package/docs-MachinaOs/nodes/android.mdx +0 -411
- package/docs-MachinaOs/nodes/overview.mdx +0 -181
- package/docs-MachinaOs/nodes/schedulers.mdx +0 -316
- package/docs-MachinaOs/nodes/webhooks.mdx +0 -330
- package/docs-MachinaOs/nodes/whatsapp.mdx +0 -305
- package/docs-MachinaOs/quickstart.mdx +0 -119
- package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +0 -177
- package/docs-MachinaOs/tutorials/android-automation.mdx +0 -242
- package/docs-MachinaOs/tutorials/first-workflow.mdx +0 -134
- package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +0 -185
- package/nul +0 -0
- package/scripts/check-ports.ps1 +0 -33
- package/scripts/kill-port.ps1 +0 -154
|
@@ -1,582 +1,579 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
import { Node, Edge } from 'reactflow';
|
|
3
|
-
import { SavedWorkflow } from '../components/ui/WorkflowSidebar';
|
|
4
|
-
import { generateWorkflowId } from '../utils/workflow';
|
|
5
|
-
import { theme } from '../styles/theme';
|
|
6
|
-
import {
|
|
7
|
-
exportWorkflowToJSON as exportToJSON,
|
|
8
|
-
exportWorkflowToFile as exportToFile,
|
|
9
|
-
importWorkflowFromJSON as importFromJSON
|
|
10
|
-
} from '../utils/workflowExport';
|
|
11
|
-
import { workflowApi } from '../services/workflowApi';
|
|
12
|
-
|
|
13
|
-
export interface WorkflowData {
|
|
14
|
-
nodes: Node[];
|
|
15
|
-
edges: Edge[];
|
|
16
|
-
name: string;
|
|
17
|
-
id: string;
|
|
18
|
-
createdAt: Date;
|
|
19
|
-
lastModified: Date;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Per-workflow UI state (n8n pattern - each workflow has isolated execution state)
|
|
23
|
-
export interface WorkflowUIState {
|
|
24
|
-
selectedNodeId: string | null;
|
|
25
|
-
executedNodes: string[]; // Array instead of Set for serialization
|
|
26
|
-
executionOrder: string[];
|
|
27
|
-
isExecuting: boolean;
|
|
28
|
-
viewport?: { x: number; y: number; zoom: number };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface AppStore {
|
|
32
|
-
// Core state - SINGLE source of truth
|
|
33
|
-
currentWorkflow: WorkflowData | null;
|
|
34
|
-
hasUnsavedChanges: boolean;
|
|
35
|
-
|
|
36
|
-
// Per-workflow UI state (n8n pattern - isolated per workflow)
|
|
37
|
-
workflowUIStates: Record<string, WorkflowUIState>;
|
|
38
|
-
|
|
39
|
-
// Global UI state (not workflow-specific)
|
|
40
|
-
selectedNode: Node | null; // Kept for backward compatibility, derived from workflowUIStates
|
|
41
|
-
sidebarVisible: boolean;
|
|
42
|
-
componentPaletteVisible: boolean;
|
|
43
|
-
proMode: boolean; // false = noob mode (only AI categories), true = pro mode (all categories)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
},
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
hasUnsavedChanges: true
|
|
580
|
-
});
|
|
581
|
-
},
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { Node, Edge } from 'reactflow';
|
|
3
|
+
import { SavedWorkflow } from '../components/ui/WorkflowSidebar';
|
|
4
|
+
import { generateWorkflowId } from '../utils/workflow';
|
|
5
|
+
import { theme } from '../styles/theme';
|
|
6
|
+
import {
|
|
7
|
+
exportWorkflowToJSON as exportToJSON,
|
|
8
|
+
exportWorkflowToFile as exportToFile,
|
|
9
|
+
importWorkflowFromJSON as importFromJSON
|
|
10
|
+
} from '../utils/workflowExport';
|
|
11
|
+
import { workflowApi } from '../services/workflowApi';
|
|
12
|
+
|
|
13
|
+
export interface WorkflowData {
|
|
14
|
+
nodes: Node[];
|
|
15
|
+
edges: Edge[];
|
|
16
|
+
name: string;
|
|
17
|
+
id: string;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
lastModified: Date;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Per-workflow UI state (n8n pattern - each workflow has isolated execution state)
|
|
23
|
+
export interface WorkflowUIState {
|
|
24
|
+
selectedNodeId: string | null;
|
|
25
|
+
executedNodes: string[]; // Array instead of Set for serialization
|
|
26
|
+
executionOrder: string[];
|
|
27
|
+
isExecuting: boolean;
|
|
28
|
+
viewport?: { x: number; y: number; zoom: number };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface AppStore {
|
|
32
|
+
// Core state - SINGLE source of truth
|
|
33
|
+
currentWorkflow: WorkflowData | null;
|
|
34
|
+
hasUnsavedChanges: boolean;
|
|
35
|
+
|
|
36
|
+
// Per-workflow UI state (n8n pattern - isolated per workflow)
|
|
37
|
+
workflowUIStates: Record<string, WorkflowUIState>;
|
|
38
|
+
|
|
39
|
+
// Global UI state (not workflow-specific)
|
|
40
|
+
selectedNode: Node | null; // Kept for backward compatibility, derived from workflowUIStates
|
|
41
|
+
sidebarVisible: boolean;
|
|
42
|
+
componentPaletteVisible: boolean;
|
|
43
|
+
proMode: boolean; // false = noob mode (only AI categories), true = pro mode (all categories)
|
|
44
|
+
renamingNodeId: string | null;
|
|
45
|
+
|
|
46
|
+
// Saved workflows
|
|
47
|
+
savedWorkflows: SavedWorkflow[];
|
|
48
|
+
|
|
49
|
+
// Workflow actions
|
|
50
|
+
setCurrentWorkflow: (workflow: WorkflowData) => void;
|
|
51
|
+
updateWorkflow: (updates: Partial<Omit<WorkflowData, 'id' | 'createdAt'>>) => void;
|
|
52
|
+
createNewWorkflow: () => void;
|
|
53
|
+
saveWorkflow: () => Promise<void>;
|
|
54
|
+
loadWorkflow: (id: string) => Promise<void>;
|
|
55
|
+
loadSavedWorkflows: () => Promise<void>;
|
|
56
|
+
deleteWorkflow: (id: string) => Promise<boolean>;
|
|
57
|
+
migrateCurrentWorkflow: () => Promise<void>;
|
|
58
|
+
|
|
59
|
+
// UI actions
|
|
60
|
+
setSelectedNode: (node: Node | null) => void;
|
|
61
|
+
toggleSidebar: () => void;
|
|
62
|
+
toggleComponentPalette: () => void;
|
|
63
|
+
toggleProMode: () => void;
|
|
64
|
+
setRenamingNodeId: (nodeId: string | null) => void;
|
|
65
|
+
|
|
66
|
+
// Per-workflow UI state actions (n8n pattern)
|
|
67
|
+
getWorkflowUIState: (workflowId: string) => WorkflowUIState;
|
|
68
|
+
setWorkflowExecuting: (workflowId: string, isExecuting: boolean) => void;
|
|
69
|
+
setWorkflowExecutedNodes: (workflowId: string, nodes: string[]) => void;
|
|
70
|
+
setWorkflowExecutionOrder: (workflowId: string, order: string[]) => void;
|
|
71
|
+
setWorkflowViewport: (workflowId: string, viewport: { x: number; y: number; zoom: number }) => void;
|
|
72
|
+
clearWorkflowExecutionState: (workflowId: string) => void;
|
|
73
|
+
|
|
74
|
+
// Node/Edge actions (operate on currentWorkflow)
|
|
75
|
+
updateNodeData: (nodeId: string, newData: any) => void;
|
|
76
|
+
updateNodes: (nodes: Node[]) => void;
|
|
77
|
+
updateEdges: (edges: Edge[]) => void;
|
|
78
|
+
addNode: (node: Node) => void;
|
|
79
|
+
removeNodes: (nodeIds: string[]) => void;
|
|
80
|
+
removeEdges: (edgeIds: string[]) => void;
|
|
81
|
+
|
|
82
|
+
// Workflow export/import
|
|
83
|
+
exportWorkflowToJSON: () => string;
|
|
84
|
+
exportWorkflowToFile: () => void;
|
|
85
|
+
importWorkflowFromJSON: (jsonString: string) => void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Helper functions
|
|
89
|
+
const createDefaultWorkflow = (): WorkflowData => ({
|
|
90
|
+
id: generateWorkflowId(),
|
|
91
|
+
name: theme.constants.defaultWorkflowName,
|
|
92
|
+
nodes: [],
|
|
93
|
+
edges: [],
|
|
94
|
+
createdAt: new Date(),
|
|
95
|
+
lastModified: new Date(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const createDefaultUIState = (): WorkflowUIState => ({
|
|
99
|
+
selectedNodeId: null,
|
|
100
|
+
executedNodes: [],
|
|
101
|
+
executionOrder: [],
|
|
102
|
+
isExecuting: false,
|
|
103
|
+
viewport: undefined,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// Helper to migrate old node types
|
|
107
|
+
const migrateNodes = (nodes: Node[]): Node[] => {
|
|
108
|
+
return nodes.map(node => {
|
|
109
|
+
if (node.type === 'googleChatModel') {
|
|
110
|
+
return { ...node, type: 'geminiChatModel' };
|
|
111
|
+
}
|
|
112
|
+
return node;
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Storage keys for UI state persistence
|
|
117
|
+
const STORAGE_KEYS = {
|
|
118
|
+
sidebarVisible: 'ui_sidebar_visible',
|
|
119
|
+
componentPaletteVisible: 'ui_component_palette_visible',
|
|
120
|
+
proMode: 'ui_pro_mode',
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// Helper to load boolean from localStorage
|
|
124
|
+
const loadBooleanFromStorage = (key: string, defaultValue: boolean): boolean => {
|
|
125
|
+
try {
|
|
126
|
+
const saved = localStorage.getItem(key);
|
|
127
|
+
if (saved !== null) {
|
|
128
|
+
return saved === 'true';
|
|
129
|
+
}
|
|
130
|
+
} catch {
|
|
131
|
+
// Ignore storage errors
|
|
132
|
+
}
|
|
133
|
+
return defaultValue;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Helper to save boolean to localStorage
|
|
137
|
+
const saveBooleanToStorage = (key: string, value: boolean): void => {
|
|
138
|
+
try {
|
|
139
|
+
localStorage.setItem(key, String(value));
|
|
140
|
+
} catch {
|
|
141
|
+
// Ignore storage errors
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const useAppStore = create<AppStore>((set, get) => ({
|
|
146
|
+
currentWorkflow: null,
|
|
147
|
+
hasUnsavedChanges: false,
|
|
148
|
+
workflowUIStates: {},
|
|
149
|
+
selectedNode: null,
|
|
150
|
+
sidebarVisible: loadBooleanFromStorage(STORAGE_KEYS.sidebarVisible, true),
|
|
151
|
+
componentPaletteVisible: loadBooleanFromStorage(STORAGE_KEYS.componentPaletteVisible, true),
|
|
152
|
+
proMode: loadBooleanFromStorage(STORAGE_KEYS.proMode, false), // Default to noob mode
|
|
153
|
+
renamingNodeId: null,
|
|
154
|
+
savedWorkflows: [],
|
|
155
|
+
|
|
156
|
+
// Workflow management
|
|
157
|
+
setCurrentWorkflow: (workflow) => {
|
|
158
|
+
set({ currentWorkflow: workflow, hasUnsavedChanges: false });
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
updateWorkflow: (updates) => {
|
|
162
|
+
const current = get().currentWorkflow;
|
|
163
|
+
if (!current) return;
|
|
164
|
+
|
|
165
|
+
const updatedWorkflow = {
|
|
166
|
+
...current,
|
|
167
|
+
...updates,
|
|
168
|
+
lastModified: new Date(),
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
set({
|
|
172
|
+
currentWorkflow: updatedWorkflow,
|
|
173
|
+
hasUnsavedChanges: true,
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
createNewWorkflow: () => {
|
|
178
|
+
const newWorkflow = createDefaultWorkflow();
|
|
179
|
+
set({
|
|
180
|
+
currentWorkflow: newWorkflow,
|
|
181
|
+
hasUnsavedChanges: false,
|
|
182
|
+
selectedNode: null,
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
saveWorkflow: async () => {
|
|
187
|
+
const { currentWorkflow, savedWorkflows } = get();
|
|
188
|
+
if (!currentWorkflow) return;
|
|
189
|
+
|
|
190
|
+
const updatedWorkflow = {
|
|
191
|
+
...currentWorkflow,
|
|
192
|
+
lastModified: new Date(),
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// Save to database
|
|
196
|
+
const success = await workflowApi.saveWorkflow(
|
|
197
|
+
updatedWorkflow.id,
|
|
198
|
+
updatedWorkflow.name,
|
|
199
|
+
{ nodes: updatedWorkflow.nodes, edges: updatedWorkflow.edges }
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
if (!success) {
|
|
203
|
+
console.error('Failed to save workflow to database');
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Update local saved workflows list
|
|
208
|
+
const existingIndex = savedWorkflows.findIndex(w => w.id === updatedWorkflow.id);
|
|
209
|
+
|
|
210
|
+
const workflowSummary: SavedWorkflow = {
|
|
211
|
+
id: updatedWorkflow.id,
|
|
212
|
+
name: updatedWorkflow.name,
|
|
213
|
+
createdAt: updatedWorkflow.createdAt,
|
|
214
|
+
lastModified: updatedWorkflow.lastModified,
|
|
215
|
+
nodeCount: updatedWorkflow.nodes.length,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
let newSavedWorkflows: SavedWorkflow[];
|
|
219
|
+
if (existingIndex >= 0) {
|
|
220
|
+
newSavedWorkflows = [...savedWorkflows];
|
|
221
|
+
newSavedWorkflows[existingIndex] = workflowSummary;
|
|
222
|
+
} else {
|
|
223
|
+
newSavedWorkflows = [workflowSummary, ...savedWorkflows];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
set({
|
|
227
|
+
currentWorkflow: updatedWorkflow,
|
|
228
|
+
savedWorkflows: newSavedWorkflows,
|
|
229
|
+
hasUnsavedChanges: false,
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
loadWorkflow: async (id) => {
|
|
234
|
+
const result = await workflowApi.getWorkflow(id);
|
|
235
|
+
if (result) {
|
|
236
|
+
// Migrate old node types
|
|
237
|
+
const nodes = migrateNodes(result.data?.nodes || []);
|
|
238
|
+
const edges = result.data?.edges || [];
|
|
239
|
+
|
|
240
|
+
const workflowData: WorkflowData = {
|
|
241
|
+
id: result.id,
|
|
242
|
+
name: result.name,
|
|
243
|
+
nodes,
|
|
244
|
+
edges,
|
|
245
|
+
createdAt: new Date(result.createdAt),
|
|
246
|
+
lastModified: new Date(result.lastModified),
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
set({
|
|
250
|
+
currentWorkflow: workflowData,
|
|
251
|
+
hasUnsavedChanges: false,
|
|
252
|
+
selectedNode: null,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
loadSavedWorkflows: async () => {
|
|
258
|
+
const workflows = await workflowApi.getAllWorkflows();
|
|
259
|
+
const savedWorkflows: SavedWorkflow[] = workflows.map(w => ({
|
|
260
|
+
id: w.id,
|
|
261
|
+
name: w.name,
|
|
262
|
+
nodeCount: w.nodeCount,
|
|
263
|
+
createdAt: new Date(w.createdAt),
|
|
264
|
+
lastModified: new Date(w.lastModified),
|
|
265
|
+
}));
|
|
266
|
+
set({ savedWorkflows });
|
|
267
|
+
|
|
268
|
+
// Auto-load the most recent workflow if no current workflow is set
|
|
269
|
+
const { currentWorkflow } = get();
|
|
270
|
+
if (!currentWorkflow && savedWorkflows.length > 0) {
|
|
271
|
+
// Sort by lastModified descending and load the first one
|
|
272
|
+
const sortedWorkflows = [...savedWorkflows].sort(
|
|
273
|
+
(a, b) => b.lastModified.getTime() - a.lastModified.getTime()
|
|
274
|
+
);
|
|
275
|
+
const mostRecent = sortedWorkflows[0];
|
|
276
|
+
await get().loadWorkflow(mostRecent.id);
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
deleteWorkflow: async (id) => {
|
|
281
|
+
const { currentWorkflow, savedWorkflows } = get();
|
|
282
|
+
|
|
283
|
+
const success = await workflowApi.deleteWorkflow(id);
|
|
284
|
+
if (!success) {
|
|
285
|
+
console.error('Failed to delete workflow from database');
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Remove from saved workflows list
|
|
290
|
+
const newSavedWorkflows = savedWorkflows.filter(w => w.id !== id);
|
|
291
|
+
|
|
292
|
+
// If deleting current workflow, create a new one
|
|
293
|
+
if (currentWorkflow?.id === id) {
|
|
294
|
+
const newWorkflow = createDefaultWorkflow();
|
|
295
|
+
set({
|
|
296
|
+
currentWorkflow: newWorkflow,
|
|
297
|
+
savedWorkflows: newSavedWorkflows,
|
|
298
|
+
hasUnsavedChanges: false,
|
|
299
|
+
selectedNode: null,
|
|
300
|
+
});
|
|
301
|
+
} else {
|
|
302
|
+
set({ savedWorkflows: newSavedWorkflows });
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return true;
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
migrateCurrentWorkflow: async () => {
|
|
309
|
+
const { currentWorkflow } = get();
|
|
310
|
+
if (!currentWorkflow || !currentWorkflow.nodes) return;
|
|
311
|
+
|
|
312
|
+
const migratedNodes = migrateNodes(currentWorkflow.nodes);
|
|
313
|
+
|
|
314
|
+
const hasChanges = migratedNodes.some((node, idx) =>
|
|
315
|
+
node.type !== currentWorkflow.nodes[idx]?.type
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
if (hasChanges) {
|
|
319
|
+
const migratedWorkflow = {
|
|
320
|
+
...currentWorkflow,
|
|
321
|
+
nodes: migratedNodes
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// Save migrated workflow to database
|
|
325
|
+
await workflowApi.saveWorkflow(
|
|
326
|
+
migratedWorkflow.id,
|
|
327
|
+
migratedWorkflow.name,
|
|
328
|
+
{ nodes: migratedWorkflow.nodes, edges: migratedWorkflow.edges }
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
set({
|
|
332
|
+
currentWorkflow: migratedWorkflow,
|
|
333
|
+
hasUnsavedChanges: false
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
// UI management
|
|
339
|
+
setSelectedNode: (node) => {
|
|
340
|
+
set({ selectedNode: node });
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
toggleSidebar: () => {
|
|
344
|
+
set((state) => {
|
|
345
|
+
const newValue = !state.sidebarVisible;
|
|
346
|
+
saveBooleanToStorage(STORAGE_KEYS.sidebarVisible, newValue);
|
|
347
|
+
return { sidebarVisible: newValue };
|
|
348
|
+
});
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
toggleComponentPalette: () => {
|
|
352
|
+
set((state) => {
|
|
353
|
+
const newValue = !state.componentPaletteVisible;
|
|
354
|
+
saveBooleanToStorage(STORAGE_KEYS.componentPaletteVisible, newValue);
|
|
355
|
+
return { componentPaletteVisible: newValue };
|
|
356
|
+
});
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
toggleProMode: () => {
|
|
360
|
+
set((state) => {
|
|
361
|
+
const newValue = !state.proMode;
|
|
362
|
+
saveBooleanToStorage(STORAGE_KEYS.proMode, newValue);
|
|
363
|
+
return { proMode: newValue };
|
|
364
|
+
});
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
setRenamingNodeId: (nodeId) => {
|
|
368
|
+
set({ renamingNodeId: nodeId });
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
// Per-workflow UI state management (n8n pattern - isolated execution state per workflow)
|
|
372
|
+
getWorkflowUIState: (workflowId) => {
|
|
373
|
+
const { workflowUIStates } = get();
|
|
374
|
+
return workflowUIStates[workflowId] || createDefaultUIState();
|
|
375
|
+
},
|
|
376
|
+
|
|
377
|
+
setWorkflowExecuting: (workflowId, isExecuting) => {
|
|
378
|
+
set((state) => {
|
|
379
|
+
const prevState = state.workflowUIStates[workflowId];
|
|
380
|
+
return {
|
|
381
|
+
workflowUIStates: {
|
|
382
|
+
...state.workflowUIStates,
|
|
383
|
+
[workflowId]: {
|
|
384
|
+
...(prevState || createDefaultUIState()),
|
|
385
|
+
isExecuting,
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
};
|
|
389
|
+
});
|
|
390
|
+
},
|
|
391
|
+
|
|
392
|
+
setWorkflowExecutedNodes: (workflowId, nodes) => {
|
|
393
|
+
set((state) => ({
|
|
394
|
+
workflowUIStates: {
|
|
395
|
+
...state.workflowUIStates,
|
|
396
|
+
[workflowId]: {
|
|
397
|
+
...(state.workflowUIStates[workflowId] || createDefaultUIState()),
|
|
398
|
+
executedNodes: nodes,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
}));
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
setWorkflowExecutionOrder: (workflowId, order) => {
|
|
405
|
+
set((state) => ({
|
|
406
|
+
workflowUIStates: {
|
|
407
|
+
...state.workflowUIStates,
|
|
408
|
+
[workflowId]: {
|
|
409
|
+
...(state.workflowUIStates[workflowId] || createDefaultUIState()),
|
|
410
|
+
executionOrder: order,
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
}));
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
setWorkflowViewport: (workflowId, viewport) => {
|
|
417
|
+
set((state) => ({
|
|
418
|
+
workflowUIStates: {
|
|
419
|
+
...state.workflowUIStates,
|
|
420
|
+
[workflowId]: {
|
|
421
|
+
...(state.workflowUIStates[workflowId] || createDefaultUIState()),
|
|
422
|
+
viewport,
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
}));
|
|
426
|
+
},
|
|
427
|
+
|
|
428
|
+
clearWorkflowExecutionState: (workflowId) => {
|
|
429
|
+
set((state) => ({
|
|
430
|
+
workflowUIStates: {
|
|
431
|
+
...state.workflowUIStates,
|
|
432
|
+
[workflowId]: {
|
|
433
|
+
...(state.workflowUIStates[workflowId] || createDefaultUIState()),
|
|
434
|
+
isExecuting: false,
|
|
435
|
+
executedNodes: [],
|
|
436
|
+
executionOrder: [],
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
}));
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
updateNodeData: (nodeId, newData) => {
|
|
443
|
+
const { currentWorkflow, selectedNode } = get();
|
|
444
|
+
if (!currentWorkflow) return;
|
|
445
|
+
|
|
446
|
+
const updatedNodes = currentWorkflow.nodes.map(node =>
|
|
447
|
+
node.id === nodeId ? { ...node, data: { ...node.data, ...newData } } : node
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
const updatedWorkflow = {
|
|
451
|
+
...currentWorkflow,
|
|
452
|
+
nodes: updatedNodes,
|
|
453
|
+
lastModified: new Date(),
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
set({
|
|
457
|
+
currentWorkflow: updatedWorkflow,
|
|
458
|
+
hasUnsavedChanges: true,
|
|
459
|
+
selectedNode: selectedNode?.id === nodeId ?
|
|
460
|
+
{ ...selectedNode, data: { ...selectedNode.data, ...newData } } :
|
|
461
|
+
selectedNode
|
|
462
|
+
});
|
|
463
|
+
},
|
|
464
|
+
|
|
465
|
+
updateNodes: (nodes) => {
|
|
466
|
+
const { currentWorkflow } = get();
|
|
467
|
+
if (!currentWorkflow) return;
|
|
468
|
+
|
|
469
|
+
const updatedWorkflow = {
|
|
470
|
+
...currentWorkflow,
|
|
471
|
+
nodes,
|
|
472
|
+
lastModified: new Date(),
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
set({
|
|
476
|
+
currentWorkflow: updatedWorkflow,
|
|
477
|
+
hasUnsavedChanges: true,
|
|
478
|
+
});
|
|
479
|
+
},
|
|
480
|
+
|
|
481
|
+
updateEdges: (edges) => {
|
|
482
|
+
const { currentWorkflow } = get();
|
|
483
|
+
if (!currentWorkflow) return;
|
|
484
|
+
|
|
485
|
+
const updatedWorkflow = {
|
|
486
|
+
...currentWorkflow,
|
|
487
|
+
edges,
|
|
488
|
+
lastModified: new Date(),
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
set({
|
|
492
|
+
currentWorkflow: updatedWorkflow,
|
|
493
|
+
hasUnsavedChanges: true,
|
|
494
|
+
});
|
|
495
|
+
},
|
|
496
|
+
|
|
497
|
+
addNode: (node) => {
|
|
498
|
+
const { currentWorkflow } = get();
|
|
499
|
+
if (!currentWorkflow) return;
|
|
500
|
+
|
|
501
|
+
const updatedWorkflow = {
|
|
502
|
+
...currentWorkflow,
|
|
503
|
+
nodes: [...currentWorkflow.nodes, node],
|
|
504
|
+
lastModified: new Date(),
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
set({
|
|
508
|
+
currentWorkflow: updatedWorkflow,
|
|
509
|
+
hasUnsavedChanges: true,
|
|
510
|
+
});
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
removeNodes: (nodeIds) => {
|
|
514
|
+
const { currentWorkflow } = get();
|
|
515
|
+
if (!currentWorkflow) return;
|
|
516
|
+
|
|
517
|
+
const updatedNodes = currentWorkflow.nodes.filter(node => !nodeIds.includes(node.id));
|
|
518
|
+
const updatedEdges = currentWorkflow.edges.filter(edge =>
|
|
519
|
+
!nodeIds.includes(edge.source) && !nodeIds.includes(edge.target)
|
|
520
|
+
);
|
|
521
|
+
|
|
522
|
+
const updatedWorkflow = {
|
|
523
|
+
...currentWorkflow,
|
|
524
|
+
nodes: updatedNodes,
|
|
525
|
+
edges: updatedEdges,
|
|
526
|
+
lastModified: new Date(),
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
set({
|
|
530
|
+
currentWorkflow: updatedWorkflow,
|
|
531
|
+
hasUnsavedChanges: true,
|
|
532
|
+
selectedNode: nodeIds.includes(get().selectedNode?.id || '') ? null : get().selectedNode,
|
|
533
|
+
});
|
|
534
|
+
},
|
|
535
|
+
|
|
536
|
+
removeEdges: (edgeIds) => {
|
|
537
|
+
const { currentWorkflow } = get();
|
|
538
|
+
if (!currentWorkflow) return;
|
|
539
|
+
|
|
540
|
+
const updatedEdges = currentWorkflow.edges.filter(edge => !edgeIds.includes(edge.id));
|
|
541
|
+
|
|
542
|
+
const updatedWorkflow = {
|
|
543
|
+
...currentWorkflow,
|
|
544
|
+
edges: updatedEdges,
|
|
545
|
+
lastModified: new Date(),
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
set({
|
|
549
|
+
currentWorkflow: updatedWorkflow,
|
|
550
|
+
hasUnsavedChanges: true,
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
|
|
554
|
+
exportWorkflowToJSON: () => {
|
|
555
|
+
const { currentWorkflow } = get();
|
|
556
|
+
if (!currentWorkflow) {
|
|
557
|
+
throw new Error('No workflow to export');
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return exportToJSON(currentWorkflow);
|
|
561
|
+
},
|
|
562
|
+
|
|
563
|
+
exportWorkflowToFile: () => {
|
|
564
|
+
const { currentWorkflow } = get();
|
|
565
|
+
if (!currentWorkflow) {
|
|
566
|
+
throw new Error('No workflow to export');
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
exportToFile(currentWorkflow);
|
|
570
|
+
},
|
|
571
|
+
|
|
572
|
+
importWorkflowFromJSON: (jsonString: string) => {
|
|
573
|
+
const workflow = importFromJSON(jsonString);
|
|
574
|
+
set({
|
|
575
|
+
currentWorkflow: workflow,
|
|
576
|
+
hasUnsavedChanges: true
|
|
577
|
+
});
|
|
578
|
+
},
|
|
582
579
|
}));
|