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.
Files changed (422) hide show
  1. package/.env.template +71 -71
  2. package/LICENSE +21 -21
  3. package/README.md +163 -87
  4. package/bin/cli.js +62 -106
  5. package/client/.dockerignore +45 -45
  6. package/client/Dockerfile +68 -68
  7. package/client/dist/assets/index-DFSC53FP.css +1 -0
  8. package/client/dist/assets/index-fJ-1gTf5.js +613 -0
  9. package/client/dist/index.html +14 -0
  10. package/client/eslint.config.js +34 -16
  11. package/client/nginx.conf +66 -66
  12. package/client/package.json +61 -48
  13. package/client/src/App.tsx +27 -27
  14. package/client/src/Dashboard.tsx +1200 -1172
  15. package/client/src/ParameterPanel.tsx +302 -300
  16. package/client/src/components/AIAgentNode.tsx +315 -321
  17. package/client/src/components/APIKeyValidator.tsx +117 -117
  18. package/client/src/components/ClaudeChatModelNode.tsx +17 -17
  19. package/client/src/components/CredentialsModal.tsx +1200 -306
  20. package/client/src/components/GeminiChatModelNode.tsx +17 -17
  21. package/client/src/components/GenericNode.tsx +356 -356
  22. package/client/src/components/LocationParameterPanel.tsx +153 -153
  23. package/client/src/components/ModelNode.tsx +285 -285
  24. package/client/src/components/OpenAIChatModelNode.tsx +17 -17
  25. package/client/src/components/OutputPanel.tsx +470 -470
  26. package/client/src/components/ParameterRenderer.tsx +1873 -1873
  27. package/client/src/components/SkillEditorModal.tsx +3 -3
  28. package/client/src/components/SquareNode.tsx +812 -796
  29. package/client/src/components/ToolkitNode.tsx +365 -365
  30. package/client/src/components/auth/LoginPage.tsx +247 -247
  31. package/client/src/components/auth/ProtectedRoute.tsx +59 -59
  32. package/client/src/components/base/BaseChatModelNode.tsx +270 -270
  33. package/client/src/components/icons/AIProviderIcons.tsx +50 -50
  34. package/client/src/components/maps/GoogleMapsPicker.tsx +136 -136
  35. package/client/src/components/maps/MapsPreviewPanel.tsx +109 -109
  36. package/client/src/components/maps/index.ts +25 -25
  37. package/client/src/components/parameterPanel/InputSection.tsx +1094 -1094
  38. package/client/src/components/parameterPanel/LocationPanelLayout.tsx +64 -64
  39. package/client/src/components/parameterPanel/MapsSection.tsx +91 -91
  40. package/client/src/components/parameterPanel/MiddleSection.tsx +867 -571
  41. package/client/src/components/parameterPanel/OutputSection.tsx +80 -80
  42. package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +81 -81
  43. package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -436
  44. package/client/src/components/parameterPanel/index.ts +41 -41
  45. package/client/src/components/shared/DataPanel.tsx +142 -142
  46. package/client/src/components/shared/JSONTreeRenderer.tsx +105 -105
  47. package/client/src/components/ui/AIResultModal.tsx +203 -203
  48. package/client/src/components/ui/ApiKeyInput.tsx +93 -0
  49. package/client/src/components/ui/CodeEditor.tsx +81 -81
  50. package/client/src/components/ui/CollapsibleSection.tsx +87 -87
  51. package/client/src/components/ui/ComponentItem.tsx +153 -153
  52. package/client/src/components/ui/ComponentPalette.tsx +320 -320
  53. package/client/src/components/ui/ConsolePanel.tsx +151 -43
  54. package/client/src/components/ui/ErrorBoundary.tsx +195 -195
  55. package/client/src/components/ui/InputNodesPanel.tsx +203 -203
  56. package/client/src/components/ui/MapSelector.tsx +313 -313
  57. package/client/src/components/ui/Modal.tsx +151 -148
  58. package/client/src/components/ui/NodeOutputPanel.tsx +1150 -1150
  59. package/client/src/components/ui/OutputDisplayPanel.tsx +381 -381
  60. package/client/src/components/ui/QRCodeDisplay.tsx +182 -0
  61. package/client/src/components/ui/TopToolbar.tsx +736 -736
  62. package/client/src/components/ui/WorkflowSidebar.tsx +293 -293
  63. package/client/src/config/antdTheme.ts +186 -186
  64. package/client/src/contexts/AuthContext.tsx +221 -221
  65. package/client/src/contexts/ThemeContext.tsx +42 -42
  66. package/client/src/contexts/WebSocketContext.tsx +2144 -1971
  67. package/client/src/factories/baseChatModelFactory.ts +255 -255
  68. package/client/src/hooks/useAndroidOperations.ts +118 -164
  69. package/client/src/hooks/useApiKeyValidation.ts +106 -106
  70. package/client/src/hooks/useApiKeys.ts +238 -238
  71. package/client/src/hooks/useAppTheme.ts +17 -17
  72. package/client/src/hooks/useComponentPalette.ts +50 -50
  73. package/client/src/hooks/useDragAndDrop.ts +123 -123
  74. package/client/src/hooks/useDragVariable.ts +88 -88
  75. package/client/src/hooks/useExecution.ts +319 -313
  76. package/client/src/hooks/useParameterPanel.ts +176 -176
  77. package/client/src/hooks/useReactFlowNodes.ts +188 -188
  78. package/client/src/hooks/useToolSchema.ts +209 -209
  79. package/client/src/hooks/useWhatsApp.ts +196 -196
  80. package/client/src/hooks/useWorkflowManagement.ts +45 -45
  81. package/client/src/index.css +314 -314
  82. package/client/src/nodeDefinitions/aiAgentNodes.ts +335 -335
  83. package/client/src/nodeDefinitions/aiModelNodes.ts +340 -340
  84. package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -383
  85. package/client/src/nodeDefinitions/chatNodes.ts +135 -135
  86. package/client/src/nodeDefinitions/codeNodes.ts +54 -54
  87. package/client/src/nodeDefinitions/index.ts +14 -14
  88. package/client/src/nodeDefinitions/locationNodes.ts +462 -462
  89. package/client/src/nodeDefinitions/schedulerNodes.ts +220 -220
  90. package/client/src/nodeDefinitions/skillNodes.ts +17 -5
  91. package/client/src/nodeDefinitions/utilityNodes.ts +284 -284
  92. package/client/src/nodeDefinitions/whatsappNodes.ts +821 -865
  93. package/client/src/nodeDefinitions.ts +101 -103
  94. package/client/src/services/dynamicParameterService.ts +95 -95
  95. package/client/src/services/execution/aiAgentExecutionService.ts +34 -34
  96. package/client/src/services/executionService.ts +227 -231
  97. package/client/src/services/workflowApi.ts +91 -91
  98. package/client/src/store/useAppStore.ts +578 -581
  99. package/client/src/styles/theme.ts +513 -508
  100. package/client/src/styles/zIndex.ts +16 -16
  101. package/client/src/types/ComponentTypes.ts +38 -38
  102. package/client/src/types/INodeProperties.ts +287 -287
  103. package/client/src/types/NodeTypes.ts +27 -27
  104. package/client/src/utils/formatters.ts +32 -32
  105. package/client/src/utils/googleMapsLoader.ts +139 -139
  106. package/client/src/utils/locationUtils.ts +84 -84
  107. package/client/src/utils/nodeUtils.ts +30 -30
  108. package/client/src/utils/workflow.ts +29 -29
  109. package/client/src/vite-env.d.ts +12 -12
  110. package/client/tailwind.config.js +59 -59
  111. package/client/tsconfig.json +25 -25
  112. package/client/vite.config.js +35 -35
  113. package/install.ps1 +308 -0
  114. package/install.sh +343 -0
  115. package/package.json +81 -70
  116. package/scripts/build.js +174 -51
  117. package/scripts/clean.js +40 -40
  118. package/scripts/start.js +234 -210
  119. package/scripts/stop.js +301 -325
  120. package/server/.dockerignore +44 -44
  121. package/server/Dockerfile +45 -45
  122. package/server/constants.py +244 -249
  123. package/server/core/cache.py +460 -460
  124. package/server/core/config.py +127 -127
  125. package/server/core/container.py +98 -98
  126. package/server/core/database.py +1296 -1210
  127. package/server/core/logging.py +313 -313
  128. package/server/main.py +288 -288
  129. package/server/middleware/__init__.py +5 -5
  130. package/server/middleware/auth.py +89 -89
  131. package/server/models/auth.py +52 -52
  132. package/server/models/cache.py +24 -24
  133. package/server/models/database.py +235 -210
  134. package/server/models/nodes.py +435 -455
  135. package/server/pyproject.toml +75 -72
  136. package/server/requirements.txt +83 -83
  137. package/server/routers/android.py +294 -294
  138. package/server/routers/auth.py +203 -203
  139. package/server/routers/database.py +150 -150
  140. package/server/routers/maps.py +141 -141
  141. package/server/routers/nodejs_compat.py +288 -288
  142. package/server/routers/webhook.py +90 -90
  143. package/server/routers/websocket.py +2239 -2127
  144. package/server/routers/whatsapp.py +761 -761
  145. package/server/routers/workflow.py +199 -199
  146. package/server/services/ai.py +2444 -2414
  147. package/server/services/android_service.py +588 -588
  148. package/server/services/auth.py +130 -130
  149. package/server/services/chat_client.py +160 -160
  150. package/server/services/deployment/manager.py +706 -706
  151. package/server/services/event_waiter.py +675 -785
  152. package/server/services/execution/executor.py +1351 -1351
  153. package/server/services/execution/models.py +1 -1
  154. package/server/services/handlers/__init__.py +122 -126
  155. package/server/services/handlers/ai.py +390 -355
  156. package/server/services/handlers/android.py +69 -260
  157. package/server/services/handlers/code.py +278 -278
  158. package/server/services/handlers/http.py +193 -193
  159. package/server/services/handlers/tools.py +146 -32
  160. package/server/services/handlers/triggers.py +107 -107
  161. package/server/services/handlers/utility.py +822 -822
  162. package/server/services/handlers/whatsapp.py +423 -476
  163. package/server/services/maps.py +288 -288
  164. package/server/services/memory_store.py +103 -103
  165. package/server/services/node_executor.py +372 -375
  166. package/server/services/scheduler.py +155 -155
  167. package/server/services/skill_loader.py +1 -1
  168. package/server/services/status_broadcaster.py +834 -826
  169. package/server/services/temporal/__init__.py +23 -23
  170. package/server/services/temporal/activities.py +344 -344
  171. package/server/services/temporal/client.py +76 -76
  172. package/server/services/temporal/executor.py +147 -147
  173. package/server/services/temporal/worker.py +251 -251
  174. package/server/services/temporal/workflow.py +355 -355
  175. package/server/services/temporal/ws_client.py +236 -236
  176. package/server/services/text.py +110 -110
  177. package/server/services/user_auth.py +172 -172
  178. package/server/services/websocket_client.py +29 -29
  179. package/server/services/workflow.py +597 -597
  180. package/server/skills/android-skill/SKILL.md +4 -4
  181. package/server/skills/code-skill/SKILL.md +123 -89
  182. package/server/skills/maps-skill/SKILL.md +3 -3
  183. package/server/skills/memory-skill/SKILL.md +1 -1
  184. package/server/skills/web-search-skill/SKILL.md +154 -0
  185. package/server/skills/whatsapp-skill/SKILL.md +3 -3
  186. package/server/uv.lock +461 -100
  187. package/server/whatsapp-rpc/.dockerignore +30 -30
  188. package/server/whatsapp-rpc/Dockerfile +44 -44
  189. package/server/whatsapp-rpc/Dockerfile.web +17 -17
  190. package/server/whatsapp-rpc/README.md +139 -139
  191. package/server/whatsapp-rpc/bin/whatsapp-rpc-server +0 -0
  192. package/server/whatsapp-rpc/cli.js +95 -95
  193. package/server/whatsapp-rpc/configs/config.yaml +6 -6
  194. package/server/whatsapp-rpc/docker-compose.yml +35 -35
  195. package/server/whatsapp-rpc/docs/API.md +410 -410
  196. package/server/whatsapp-rpc/node_modules/.package-lock.json +259 -0
  197. package/server/whatsapp-rpc/node_modules/chalk/license +9 -0
  198. package/server/whatsapp-rpc/node_modules/chalk/package.json +83 -0
  199. package/server/whatsapp-rpc/node_modules/chalk/readme.md +297 -0
  200. package/server/whatsapp-rpc/node_modules/chalk/source/index.d.ts +325 -0
  201. package/server/whatsapp-rpc/node_modules/chalk/source/index.js +225 -0
  202. package/server/whatsapp-rpc/node_modules/chalk/source/utilities.js +33 -0
  203. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  204. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  205. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  206. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
  207. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  208. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
  209. package/server/whatsapp-rpc/node_modules/commander/LICENSE +22 -0
  210. package/server/whatsapp-rpc/node_modules/commander/Readme.md +1148 -0
  211. package/server/whatsapp-rpc/node_modules/commander/esm.mjs +16 -0
  212. package/server/whatsapp-rpc/node_modules/commander/index.js +26 -0
  213. package/server/whatsapp-rpc/node_modules/commander/lib/argument.js +145 -0
  214. package/server/whatsapp-rpc/node_modules/commander/lib/command.js +2179 -0
  215. package/server/whatsapp-rpc/node_modules/commander/lib/error.js +43 -0
  216. package/server/whatsapp-rpc/node_modules/commander/lib/help.js +462 -0
  217. package/server/whatsapp-rpc/node_modules/commander/lib/option.js +329 -0
  218. package/server/whatsapp-rpc/node_modules/commander/lib/suggestSimilar.js +100 -0
  219. package/server/whatsapp-rpc/node_modules/commander/package-support.json +16 -0
  220. package/server/whatsapp-rpc/node_modules/commander/package.json +80 -0
  221. package/server/whatsapp-rpc/node_modules/commander/typings/esm.d.mts +3 -0
  222. package/server/whatsapp-rpc/node_modules/commander/typings/index.d.ts +884 -0
  223. package/server/whatsapp-rpc/node_modules/cross-spawn/LICENSE +21 -0
  224. package/server/whatsapp-rpc/node_modules/cross-spawn/README.md +89 -0
  225. package/server/whatsapp-rpc/node_modules/cross-spawn/index.js +39 -0
  226. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/enoent.js +59 -0
  227. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/parse.js +91 -0
  228. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/escape.js +47 -0
  229. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  230. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  231. package/server/whatsapp-rpc/node_modules/cross-spawn/package.json +73 -0
  232. package/server/whatsapp-rpc/node_modules/execa/index.d.ts +955 -0
  233. package/server/whatsapp-rpc/node_modules/execa/index.js +309 -0
  234. package/server/whatsapp-rpc/node_modules/execa/lib/command.js +119 -0
  235. package/server/whatsapp-rpc/node_modules/execa/lib/error.js +87 -0
  236. package/server/whatsapp-rpc/node_modules/execa/lib/kill.js +102 -0
  237. package/server/whatsapp-rpc/node_modules/execa/lib/pipe.js +42 -0
  238. package/server/whatsapp-rpc/node_modules/execa/lib/promise.js +36 -0
  239. package/server/whatsapp-rpc/node_modules/execa/lib/stdio.js +49 -0
  240. package/server/whatsapp-rpc/node_modules/execa/lib/stream.js +133 -0
  241. package/server/whatsapp-rpc/node_modules/execa/lib/verbose.js +19 -0
  242. package/server/whatsapp-rpc/node_modules/execa/license +9 -0
  243. package/server/whatsapp-rpc/node_modules/execa/package.json +90 -0
  244. package/server/whatsapp-rpc/node_modules/execa/readme.md +822 -0
  245. package/server/whatsapp-rpc/node_modules/get-stream/license +9 -0
  246. package/server/whatsapp-rpc/node_modules/get-stream/package.json +53 -0
  247. package/server/whatsapp-rpc/node_modules/get-stream/readme.md +291 -0
  248. package/server/whatsapp-rpc/node_modules/get-stream/source/array-buffer.js +84 -0
  249. package/server/whatsapp-rpc/node_modules/get-stream/source/array.js +32 -0
  250. package/server/whatsapp-rpc/node_modules/get-stream/source/buffer.js +20 -0
  251. package/server/whatsapp-rpc/node_modules/get-stream/source/contents.js +101 -0
  252. package/server/whatsapp-rpc/node_modules/get-stream/source/index.d.ts +119 -0
  253. package/server/whatsapp-rpc/node_modules/get-stream/source/index.js +5 -0
  254. package/server/whatsapp-rpc/node_modules/get-stream/source/string.js +36 -0
  255. package/server/whatsapp-rpc/node_modules/get-stream/source/utils.js +11 -0
  256. package/server/whatsapp-rpc/node_modules/get-them-args/LICENSE +21 -0
  257. package/server/whatsapp-rpc/node_modules/get-them-args/README.md +95 -0
  258. package/server/whatsapp-rpc/node_modules/get-them-args/index.js +97 -0
  259. package/server/whatsapp-rpc/node_modules/get-them-args/package.json +36 -0
  260. package/server/whatsapp-rpc/node_modules/human-signals/LICENSE +201 -0
  261. package/server/whatsapp-rpc/node_modules/human-signals/README.md +168 -0
  262. package/server/whatsapp-rpc/node_modules/human-signals/build/src/core.js +273 -0
  263. package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.d.ts +73 -0
  264. package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.js +70 -0
  265. package/server/whatsapp-rpc/node_modules/human-signals/build/src/realtime.js +16 -0
  266. package/server/whatsapp-rpc/node_modules/human-signals/build/src/signals.js +34 -0
  267. package/server/whatsapp-rpc/node_modules/human-signals/package.json +61 -0
  268. package/server/whatsapp-rpc/node_modules/is-stream/index.d.ts +81 -0
  269. package/server/whatsapp-rpc/node_modules/is-stream/index.js +29 -0
  270. package/server/whatsapp-rpc/node_modules/is-stream/license +9 -0
  271. package/server/whatsapp-rpc/node_modules/is-stream/package.json +44 -0
  272. package/server/whatsapp-rpc/node_modules/is-stream/readme.md +60 -0
  273. package/server/whatsapp-rpc/node_modules/isexe/LICENSE +15 -0
  274. package/server/whatsapp-rpc/node_modules/isexe/README.md +51 -0
  275. package/server/whatsapp-rpc/node_modules/isexe/index.js +57 -0
  276. package/server/whatsapp-rpc/node_modules/isexe/mode.js +41 -0
  277. package/server/whatsapp-rpc/node_modules/isexe/package.json +31 -0
  278. package/server/whatsapp-rpc/node_modules/isexe/test/basic.js +221 -0
  279. package/server/whatsapp-rpc/node_modules/isexe/windows.js +42 -0
  280. package/server/whatsapp-rpc/node_modules/kill-port/.editorconfig +12 -0
  281. package/server/whatsapp-rpc/node_modules/kill-port/.gitattributes +1 -0
  282. package/server/whatsapp-rpc/node_modules/kill-port/LICENSE +21 -0
  283. package/server/whatsapp-rpc/node_modules/kill-port/README.md +140 -0
  284. package/server/whatsapp-rpc/node_modules/kill-port/cli.js +25 -0
  285. package/server/whatsapp-rpc/node_modules/kill-port/example.js +21 -0
  286. package/server/whatsapp-rpc/node_modules/kill-port/index.js +46 -0
  287. package/server/whatsapp-rpc/node_modules/kill-port/logo.png +0 -0
  288. package/server/whatsapp-rpc/node_modules/kill-port/package.json +41 -0
  289. package/server/whatsapp-rpc/node_modules/kill-port/pnpm-lock.yaml +4606 -0
  290. package/server/whatsapp-rpc/node_modules/kill-port/test.js +16 -0
  291. package/server/whatsapp-rpc/node_modules/merge-stream/LICENSE +21 -0
  292. package/server/whatsapp-rpc/node_modules/merge-stream/README.md +78 -0
  293. package/server/whatsapp-rpc/node_modules/merge-stream/index.js +41 -0
  294. package/server/whatsapp-rpc/node_modules/merge-stream/package.json +19 -0
  295. package/server/whatsapp-rpc/node_modules/mimic-fn/index.d.ts +52 -0
  296. package/server/whatsapp-rpc/node_modules/mimic-fn/index.js +71 -0
  297. package/server/whatsapp-rpc/node_modules/mimic-fn/license +9 -0
  298. package/server/whatsapp-rpc/node_modules/mimic-fn/package.json +45 -0
  299. package/server/whatsapp-rpc/node_modules/mimic-fn/readme.md +90 -0
  300. package/server/whatsapp-rpc/node_modules/npm-run-path/index.d.ts +90 -0
  301. package/server/whatsapp-rpc/node_modules/npm-run-path/index.js +52 -0
  302. package/server/whatsapp-rpc/node_modules/npm-run-path/license +9 -0
  303. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.d.ts +31 -0
  304. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.js +12 -0
  305. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/license +9 -0
  306. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/package.json +41 -0
  307. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/readme.md +57 -0
  308. package/server/whatsapp-rpc/node_modules/npm-run-path/package.json +49 -0
  309. package/server/whatsapp-rpc/node_modules/npm-run-path/readme.md +104 -0
  310. package/server/whatsapp-rpc/node_modules/onetime/index.d.ts +59 -0
  311. package/server/whatsapp-rpc/node_modules/onetime/index.js +41 -0
  312. package/server/whatsapp-rpc/node_modules/onetime/license +9 -0
  313. package/server/whatsapp-rpc/node_modules/onetime/package.json +45 -0
  314. package/server/whatsapp-rpc/node_modules/onetime/readme.md +94 -0
  315. package/server/whatsapp-rpc/node_modules/path-key/index.d.ts +40 -0
  316. package/server/whatsapp-rpc/node_modules/path-key/index.js +16 -0
  317. package/server/whatsapp-rpc/node_modules/path-key/license +9 -0
  318. package/server/whatsapp-rpc/node_modules/path-key/package.json +39 -0
  319. package/server/whatsapp-rpc/node_modules/path-key/readme.md +61 -0
  320. package/server/whatsapp-rpc/node_modules/shebang-command/index.js +19 -0
  321. package/server/whatsapp-rpc/node_modules/shebang-command/license +9 -0
  322. package/server/whatsapp-rpc/node_modules/shebang-command/package.json +34 -0
  323. package/server/whatsapp-rpc/node_modules/shebang-command/readme.md +34 -0
  324. package/server/whatsapp-rpc/node_modules/shebang-regex/index.d.ts +22 -0
  325. package/server/whatsapp-rpc/node_modules/shebang-regex/index.js +2 -0
  326. package/server/whatsapp-rpc/node_modules/shebang-regex/license +9 -0
  327. package/server/whatsapp-rpc/node_modules/shebang-regex/package.json +35 -0
  328. package/server/whatsapp-rpc/node_modules/shebang-regex/readme.md +33 -0
  329. package/server/whatsapp-rpc/node_modules/shell-exec/LICENSE +21 -0
  330. package/server/whatsapp-rpc/node_modules/shell-exec/README.md +60 -0
  331. package/server/whatsapp-rpc/node_modules/shell-exec/index.js +47 -0
  332. package/server/whatsapp-rpc/node_modules/shell-exec/package.json +29 -0
  333. package/server/whatsapp-rpc/node_modules/signal-exit/LICENSE.txt +16 -0
  334. package/server/whatsapp-rpc/node_modules/signal-exit/README.md +74 -0
  335. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
  336. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
  337. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js +10 -0
  338. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
  339. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
  340. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
  341. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js +279 -0
  342. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
  343. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/package.json +3 -0
  344. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
  345. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
  346. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js +42 -0
  347. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
  348. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
  349. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
  350. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js +4 -0
  351. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
  352. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
  353. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
  354. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js +275 -0
  355. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
  356. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/package.json +3 -0
  357. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
  358. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
  359. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js +39 -0
  360. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
  361. package/server/whatsapp-rpc/node_modules/signal-exit/package.json +106 -0
  362. package/server/whatsapp-rpc/node_modules/strip-final-newline/index.js +14 -0
  363. package/server/whatsapp-rpc/node_modules/strip-final-newline/license +9 -0
  364. package/server/whatsapp-rpc/node_modules/strip-final-newline/package.json +43 -0
  365. package/server/whatsapp-rpc/node_modules/strip-final-newline/readme.md +35 -0
  366. package/server/whatsapp-rpc/node_modules/which/CHANGELOG.md +166 -0
  367. package/server/whatsapp-rpc/node_modules/which/LICENSE +15 -0
  368. package/server/whatsapp-rpc/node_modules/which/README.md +54 -0
  369. package/server/whatsapp-rpc/node_modules/which/bin/node-which +52 -0
  370. package/server/whatsapp-rpc/node_modules/which/package.json +43 -0
  371. package/server/whatsapp-rpc/node_modules/which/which.js +125 -0
  372. package/server/whatsapp-rpc/package-lock.json +272 -0
  373. package/server/whatsapp-rpc/package.json +30 -30
  374. package/server/whatsapp-rpc/schema.json +1294 -1294
  375. package/server/whatsapp-rpc/scripts/clean.cjs +66 -66
  376. package/server/whatsapp-rpc/scripts/cli.js +162 -162
  377. package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -166
  378. package/server/whatsapp-rpc/src/python/pyproject.toml +15 -15
  379. package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -4
  380. package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -427
  381. package/server/whatsapp-rpc/web/app.py +609 -609
  382. package/server/whatsapp-rpc/web/requirements.txt +6 -6
  383. package/server/whatsapp-rpc/web/rpc_client.py +427 -427
  384. package/server/whatsapp-rpc/web/static/openapi.yaml +59 -59
  385. package/server/whatsapp-rpc/web/templates/base.html +149 -149
  386. package/server/whatsapp-rpc/web/templates/contacts.html +240 -240
  387. package/server/whatsapp-rpc/web/templates/dashboard.html +319 -319
  388. package/server/whatsapp-rpc/web/templates/groups.html +328 -328
  389. package/server/whatsapp-rpc/web/templates/messages.html +465 -465
  390. package/server/whatsapp-rpc/web/templates/messaging.html +680 -680
  391. package/server/whatsapp-rpc/web/templates/send.html +258 -258
  392. package/server/whatsapp-rpc/web/templates/settings.html +459 -459
  393. package/client/src/components/ui/AndroidSettingsPanel.tsx +0 -401
  394. package/client/src/components/ui/WhatsAppSettingsPanel.tsx +0 -345
  395. package/client/src/nodeDefinitions/androidDeviceNodes.ts +0 -140
  396. package/docker-compose.prod.yml +0 -107
  397. package/docker-compose.yml +0 -104
  398. package/docs-MachinaOs/README.md +0 -85
  399. package/docs-MachinaOs/deployment/docker.mdx +0 -228
  400. package/docs-MachinaOs/deployment/production.mdx +0 -345
  401. package/docs-MachinaOs/docs.json +0 -75
  402. package/docs-MachinaOs/faq.mdx +0 -309
  403. package/docs-MachinaOs/favicon.svg +0 -5
  404. package/docs-MachinaOs/installation.mdx +0 -160
  405. package/docs-MachinaOs/introduction.mdx +0 -114
  406. package/docs-MachinaOs/logo/dark.svg +0 -6
  407. package/docs-MachinaOs/logo/light.svg +0 -6
  408. package/docs-MachinaOs/nodes/ai-agent.mdx +0 -216
  409. package/docs-MachinaOs/nodes/ai-models.mdx +0 -240
  410. package/docs-MachinaOs/nodes/android.mdx +0 -411
  411. package/docs-MachinaOs/nodes/overview.mdx +0 -181
  412. package/docs-MachinaOs/nodes/schedulers.mdx +0 -316
  413. package/docs-MachinaOs/nodes/webhooks.mdx +0 -330
  414. package/docs-MachinaOs/nodes/whatsapp.mdx +0 -305
  415. package/docs-MachinaOs/quickstart.mdx +0 -119
  416. package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +0 -177
  417. package/docs-MachinaOs/tutorials/android-automation.mdx +0 -242
  418. package/docs-MachinaOs/tutorials/first-workflow.mdx +0 -134
  419. package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +0 -185
  420. package/nul +0 -0
  421. package/scripts/check-ports.ps1 +0 -33
  422. package/scripts/kill-port.ps1 +0 -154
@@ -1,1094 +1,1094 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { useAppStore } from '../../store/useAppStore';
3
- import { nodeDefinitions } from '../../nodeDefinitions';
4
- import { useWebSocket } from '../../contexts/WebSocketContext';
5
- import { Node, Edge } from 'reactflow';
6
- import { useDragVariable } from '../../hooks/useDragVariable';
7
- import { useAppTheme } from '../../hooks/useAppTheme';
8
-
9
- interface InputSectionProps {
10
- nodeId: string;
11
- visible?: boolean;
12
- }
13
-
14
- interface NodeData {
15
- id: string;
16
- name: string;
17
- type: string;
18
- icon: string;
19
- inputData?: any;
20
- outputSchema: Record<string, any>;
21
- hasExecutionData: boolean;
22
- }
23
-
24
- // Helper to render icon (handles both image URLs and emoji/text)
25
- const renderNodeIcon = (icon: string, size: number = 16) => {
26
- if (icon.startsWith('data:') || icon.startsWith('http') || icon.startsWith('/')) {
27
- return (
28
- <img
29
- src={icon}
30
- alt="icon"
31
- style={{ width: size, height: size, objectFit: 'contain' }}
32
- />
33
- );
34
- }
35
- return <span style={{ fontSize: size - 2 }}>{icon}</span>;
36
- };
37
-
38
- const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) => {
39
- const theme = useAppTheme();
40
- const { currentWorkflow } = useAppStore();
41
- const { getNodeOutput } = useWebSocket();
42
- const [expandedNodes, setExpandedNodes] = useState<Set<string>>(new Set());
43
- const [connectedNodes, setConnectedNodes] = useState<NodeData[]>([]);
44
- const [loading, setLoading] = useState(false);
45
- const { handleVariableDragStart, getTemplateVariableName } = useDragVariable(nodeId);
46
-
47
- // Fetch connected node data with execution results from backend
48
- useEffect(() => {
49
- const fetchConnectedNodes = async () => {
50
- if (!currentWorkflow || !nodeId) {
51
- setConnectedNodes([]);
52
- return;
53
- }
54
-
55
- setLoading(true);
56
- const nodes = currentWorkflow.nodes || [];
57
- const edges = currentWorkflow.edges || [];
58
-
59
- // Helper to check if a handle is a config/auxiliary handle (not main data flow)
60
- const isConfigHandle = (handle: string | null | undefined): boolean => {
61
- if (!handle) return false;
62
- // Config handles follow pattern: input-<type> where type is not 'main'
63
- // Examples: input-memory, input-tools, input-model
64
- if (handle.startsWith('input-') && handle !== 'input-main') {
65
- return true;
66
- }
67
- return false;
68
- };
69
-
70
- // Helper to check if a node is a config/auxiliary node (connects to config handles)
71
- const isConfigNode = (nodeType: string | undefined): boolean => {
72
- if (!nodeType) return false;
73
- const definition = nodeDefinitions[nodeType];
74
- if (!definition) return false;
75
- // Config nodes typically have 'memory' or 'tool' in their group
76
- const groups = definition.group || [];
77
- return groups.includes('memory') || groups.includes('tool');
78
- };
79
-
80
- // Get current node info
81
- const currentNode = nodes.find((node: Node) => node.id === nodeId);
82
- const currentNodeType = currentNode?.type;
83
-
84
- // Collect all edges to process (direct + inherited from parent for config nodes)
85
- interface EdgeWithLabel { edge: Edge; label?: string }
86
- const edgesToProcess: EdgeWithLabel[] = [];
87
-
88
- // 1. Add direct incoming edges (excluding config handle connections)
89
- const directEdges = edges.filter((edge: Edge) => {
90
- if (edge.target !== nodeId) return false;
91
- if (isConfigHandle(edge.targetHandle)) return false;
92
- return true;
93
- });
94
- directEdges.forEach(edge => edgesToProcess.push({ edge }));
95
-
96
- // 2. If current node is a config node (memory, tool), inherit parent node's main inputs
97
- if (isConfigNode(currentNodeType)) {
98
- const outgoingEdges = edges.filter((edge: Edge) => edge.source === nodeId);
99
-
100
- for (const outEdge of outgoingEdges) {
101
- // Check if connected to a config handle on the target
102
- if (isConfigHandle(outEdge.targetHandle)) {
103
- const targetNode = nodes.find((node: Node) => node.id === outEdge.target);
104
- if (!targetNode) continue;
105
-
106
- const targetDef = nodeDefinitions[targetNode.type || ''];
107
- const targetName = targetDef?.displayName || targetNode.type;
108
-
109
- // Find nodes connected to the parent's main input (non-config handles)
110
- const parentInputEdges = edges.filter(
111
- (e: Edge) => e.target === targetNode.id && !isConfigHandle(e.targetHandle)
112
- );
113
-
114
- for (const parentEdge of parentInputEdges) {
115
- edgesToProcess.push({ edge: parentEdge, label: `via ${targetName}` });
116
- }
117
- }
118
- }
119
- }
120
-
121
- const nodeDataPromises = edgesToProcess.map(async ({ edge, label }) => {
122
- const sourceNode = nodes.find((node: Node) => node.id === edge.source);
123
- const nodeType = sourceNode?.type || '';
124
- const nodeDef = nodeDefinitions[nodeType];
125
-
126
- const executionData = await getNodeOutput(edge.source, 'output_0');
127
- let inputData: any = null;
128
- let outputSchema: Record<string, any>;
129
- let hasExecutionData = false;
130
-
131
- if (executionData && executionData[0] && executionData[0][0]) {
132
- const rawData = executionData[0][0].json || executionData[0][0];
133
- if (typeof rawData === 'object' && rawData !== null) {
134
- inputData = rawData;
135
- outputSchema = rawData;
136
- hasExecutionData = true;
137
- } else {
138
- inputData = { value: rawData };
139
- outputSchema = { value: typeof rawData };
140
- hasExecutionData = true;
141
- }
142
- } else {
143
- hasExecutionData = false;
144
-
145
- if (nodeType === 'start') {
146
- try {
147
- const initialData = sourceNode?.data?.initialData || '{}';
148
- outputSchema = typeof initialData === 'string' ? JSON.parse(initialData) : initialData;
149
- } catch (e) {
150
- outputSchema = {};
151
- }
152
- } else {
153
- const sampleSchemas: Record<string, Record<string, any>> = {
154
- location: { latitude: 'number', longitude: 'number', accuracy: 'number', provider: 'string', altitude: 'number' },
155
- ai: { response: 'string', thinking: 'string', model: 'string', provider: 'string', finish_reason: 'string', timestamp: 'string' },
156
- file: { fileName: 'string', fileSize: 'number' },
157
- whatsapp: {
158
- message_id: 'string',
159
- sender: 'string',
160
- sender_phone: 'string',
161
- chat_id: 'string',
162
- message_type: 'string',
163
- text: 'string',
164
- timestamp: 'string',
165
- is_group: 'boolean',
166
- is_from_me: 'boolean',
167
- push_name: 'string',
168
- media: 'object',
169
- group_info: {
170
- group_jid: 'string',
171
- sender_jid: 'string',
172
- sender_phone: 'string',
173
- sender_name: 'string'
174
- }
175
- },
176
- whatsappDb: {
177
- // Output varies by operation - this shows chat_history output
178
- operation: 'string',
179
- // chat_history output
180
- messages: [
181
- {
182
- text: 'string',
183
- sender: 'string',
184
- sender_phone: 'string',
185
- message_type: 'string',
186
- timestamp: 'string',
187
- message_id: 'string',
188
- is_from_me: 'boolean',
189
- is_group: 'boolean',
190
- push_name: 'string',
191
- index: 'number'
192
- }
193
- ],
194
- total: 'number',
195
- has_more: 'boolean',
196
- count: 'number',
197
- chat_type: 'string',
198
- // search_groups / list_contacts output
199
- groups: [{ jid: 'string', name: 'string', participant_count: 'number' }],
200
- contacts: [{ jid: 'string', phone: 'string', name: 'string', push_name: 'string' }],
201
- // get_group_info output
202
- participants: [{ jid: 'string', phone: 'string', name: 'string', is_admin: 'boolean' }],
203
- // get_contact_info output
204
- jid: 'string',
205
- phone: 'string',
206
- name: 'string',
207
- push_name: 'string',
208
- business_name: 'string',
209
- is_business: 'boolean',
210
- is_contact: 'boolean',
211
- profile_pic: 'string',
212
- timestamp: 'string'
213
- },
214
- webhook: {
215
- method: 'string',
216
- path: 'string',
217
- headers: 'object',
218
- query: 'object',
219
- body: 'string',
220
- json: 'object'
221
- },
222
- httpRequest: {
223
- status: 'number',
224
- data: 'any',
225
- headers: 'object',
226
- url: 'string',
227
- method: 'string'
228
- },
229
- python: { output: 'any' },
230
- javascript: { output: 'any' },
231
- memory: {
232
- session_id: 'string',
233
- messages: 'array',
234
- message_count: 'number',
235
- memory_type: 'string',
236
- window_size: 'number'
237
- },
238
- cronScheduler: {
239
- timestamp: 'string',
240
- iteration: 'number',
241
- start_mode: 'string',
242
- frequency: 'string',
243
- timezone: 'string',
244
- schedule: 'string',
245
- scheduled_time: 'string',
246
- triggered_at: 'string',
247
- waited_seconds: 'number',
248
- message: 'string'
249
- },
250
- // Android service schemas
251
- android: {
252
- service_id: 'string',
253
- action: 'string',
254
- data: 'object',
255
- success: 'boolean'
256
- },
257
- batteryMonitor: {
258
- battery_level: 'number',
259
- is_charging: 'boolean',
260
- temperature_celsius: 'number',
261
- health: 'string',
262
- voltage: 'number'
263
- },
264
- systemInfo: {
265
- device_model: 'string',
266
- android_version: 'string',
267
- api_level: 'number',
268
- manufacturer: 'string',
269
- total_memory: 'number',
270
- available_memory: 'number'
271
- },
272
- networkMonitor: {
273
- connected: 'boolean',
274
- type: 'string',
275
- wifi_ssid: 'string',
276
- ip_address: 'string'
277
- },
278
- wifiAutomation: {
279
- wifi_enabled: 'boolean',
280
- ssid: 'string',
281
- ip_address: 'string',
282
- signal_strength: 'number'
283
- },
284
- bluetoothAutomation: {
285
- bluetooth_enabled: 'boolean',
286
- paired_devices: 'array',
287
- connected_devices: 'array'
288
- },
289
- audioAutomation: {
290
- music_volume: 'number',
291
- ring_volume: 'number',
292
- muted: 'boolean'
293
- },
294
- androidLocation: {
295
- latitude: 'number',
296
- longitude: 'number',
297
- accuracy: 'number',
298
- provider: 'string',
299
- altitude: 'number',
300
- speed: 'number',
301
- bearing: 'number'
302
- },
303
- appLauncher: {
304
- package_name: 'string',
305
- launched: 'boolean',
306
- app_name: 'string'
307
- },
308
- appList: {
309
- apps: 'array',
310
- count: 'number'
311
- },
312
- deviceStateAutomation: {
313
- airplane_mode: 'boolean',
314
- screen_on: 'boolean',
315
- brightness: 'number'
316
- },
317
- screenControlAutomation: {
318
- brightness: 'number',
319
- auto_brightness: 'boolean',
320
- screen_timeout: 'number'
321
- },
322
- airplaneModeControl: {
323
- airplane_mode_enabled: 'boolean'
324
- },
325
- motionDetection: {
326
- accelerometer: { x: 'number', y: 'number', z: 'number' },
327
- gyroscope: { x: 'number', y: 'number', z: 'number' },
328
- motion_detected: 'boolean'
329
- },
330
- environmentalSensors: {
331
- temperature: 'number',
332
- humidity: 'number',
333
- pressure: 'number',
334
- light_level: 'number'
335
- },
336
- cameraControl: {
337
- cameras: 'array',
338
- photo_path: 'string',
339
- success: 'boolean'
340
- },
341
- mediaControl: {
342
- volume: 'number',
343
- is_playing: 'boolean',
344
- current_track: 'string'
345
- },
346
- chatTrigger: {
347
- message: 'string',
348
- timestamp: 'string',
349
- session_id: 'string'
350
- },
351
- // Document processing schemas
352
- httpScraper: {
353
- items: 'array',
354
- item_count: 'number',
355
- errors: 'array'
356
- },
357
- fileDownloader: {
358
- downloaded: 'number',
359
- skipped: 'number',
360
- failed: 'number',
361
- files: 'array',
362
- output_dir: 'string'
363
- },
364
- documentParser: {
365
- documents: 'array',
366
- parsed_count: 'number',
367
- failed: 'array'
368
- },
369
- textChunker: {
370
- chunks: 'array',
371
- chunk_count: 'number'
372
- },
373
- embeddingGenerator: {
374
- embeddings: 'array',
375
- embedding_count: 'number',
376
- dimensions: 'number',
377
- chunks: 'array'
378
- },
379
- vectorStore: {
380
- stored_count: 'number',
381
- matches: 'array',
382
- collection_name: 'string',
383
- backend: 'string'
384
- }
385
- };
386
-
387
- // Node type detection
388
- const isMemory = nodeType === 'simpleMemory';
389
- const nodeTypeLower = nodeType.toLowerCase();
390
- const isAI = !isMemory && (nodeTypeLower.includes('chatmodel') || nodeTypeLower.includes('aiagent') || nodeTypeLower.includes('chatagent'));
391
- const isFile = nodeType.includes('file');
392
- const isWhatsAppDb = nodeType === 'whatsappDb';
393
- const isWhatsApp = !isWhatsAppDb && (nodeType.includes('whatsapp') || nodeType.includes('Whatsapp'));
394
- const isWebhook = nodeType === 'webhookTrigger';
395
- const isHttpRequest = nodeType === 'httpRequest';
396
- const isPython = nodeType.includes('python') || nodeType.includes('Python');
397
- const isJavaScript = nodeType.includes('javascript') || nodeType.includes('Javascript');
398
- const isCodeExecutor = isPython || isJavaScript;
399
- const isCronScheduler = nodeType === 'cronScheduler';
400
- const isChatTrigger = nodeType === 'chatTrigger';
401
-
402
- // Document processing node detection
403
- const documentNodeTypes = ['httpScraper', 'fileDownloader', 'documentParser', 'textChunker', 'embeddingGenerator', 'vectorStore'];
404
- const isDocumentNode = documentNodeTypes.includes(nodeType);
405
-
406
- // Android service node detection - check for specific Android node types
407
- const androidNodeTypes = [
408
- 'batteryMonitor', 'systemInfo', 'networkMonitor',
409
- 'wifiAutomation', 'bluetoothAutomation', 'audioAutomation',
410
- 'deviceStateAutomation', 'screenControlAutomation', 'airplaneModeControl',
411
- 'motionDetection', 'environmentalSensors', 'cameraControl', 'mediaControl',
412
- 'appLauncher', 'appList'
413
- ];
414
- const isAndroidNode = androidNodeTypes.includes(nodeType);
415
- const isAndroidLocation = nodeType === 'location';
416
-
417
- // Location nodes (Google Maps, not Android location)
418
- const isLocationNode = nodeType.includes('location') && !isAndroidLocation;
419
- const isGoogleMaps = nodeType === 'createMap' || nodeType === 'addLocations' || nodeType === 'showNearbyPlaces';
420
-
421
- // Select appropriate schema
422
- if (isAndroidLocation) {
423
- outputSchema = sampleSchemas.androidLocation;
424
- } else if (isAndroidNode && sampleSchemas[nodeType as keyof typeof sampleSchemas]) {
425
- outputSchema = sampleSchemas[nodeType as keyof typeof sampleSchemas];
426
- } else if (isDocumentNode && sampleSchemas[nodeType as keyof typeof sampleSchemas]) {
427
- outputSchema = sampleSchemas[nodeType as keyof typeof sampleSchemas];
428
- } else {
429
- outputSchema = isLocationNode || isGoogleMaps ? sampleSchemas.location :
430
- isMemory ? sampleSchemas.memory :
431
- isAI ? sampleSchemas.ai :
432
- isFile ? sampleSchemas.file :
433
- isWhatsAppDb ? sampleSchemas.whatsappDb :
434
- isWhatsApp ? sampleSchemas.whatsapp :
435
- isWebhook ? sampleSchemas.webhook :
436
- isHttpRequest ? sampleSchemas.httpRequest :
437
- isCodeExecutor ? sampleSchemas.python :
438
- isCronScheduler ? sampleSchemas.cronScheduler :
439
- isChatTrigger ? sampleSchemas.chatTrigger :
440
- { data: 'any' };
441
- }
442
- }
443
- }
444
-
445
- const baseName = sourceNode?.data?.label || nodeDef?.displayName || nodeType;
446
- return {
447
- id: edge.source,
448
- name: label ? `${baseName} (${label})` : baseName,
449
- type: nodeType,
450
- icon: nodeDef?.icon || '',
451
- inputData,
452
- outputSchema,
453
- hasExecutionData
454
- };
455
- });
456
-
457
- const nodeDataResults = await Promise.all(nodeDataPromises);
458
- setConnectedNodes(nodeDataResults);
459
- // Auto-expand all nodes initially
460
- setExpandedNodes(new Set(nodeDataResults.map(n => n.id)));
461
- setLoading(false);
462
- };
463
-
464
- fetchConnectedNodes();
465
- }, [nodeId, currentWorkflow, getNodeOutput]);
466
-
467
- const toggleNode = (nodeId: string) => {
468
- setExpandedNodes(prev => {
469
- const next = new Set(prev);
470
- if (next.has(nodeId)) {
471
- next.delete(nodeId);
472
- } else {
473
- next.add(nodeId);
474
- }
475
- return next;
476
- });
477
- };
478
-
479
- // Render draggable property
480
- // NOTE: sourceNodeId is the unique node ID, used for template variable resolution
481
- const renderDraggableProperty = (key: string, value: any, sourceNodeId: string, path: string = '', depth: number = 0, maxArrayItems: number = 3) => {
482
- const currentPath = path ? `${path}.${key}` : key;
483
- const isObject = typeof value === 'object' && value !== null && !Array.isArray(value);
484
- const isArray = Array.isArray(value);
485
-
486
- // Handle arrays - show indexed items
487
- if (isArray && value.length > 0) {
488
- const templateName = getTemplateVariableName(sourceNodeId);
489
- const itemsToShow = Math.min(value.length, maxArrayItems);
490
-
491
- return (
492
- <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
493
- <div style={{
494
- fontSize: theme.fontSize.xs,
495
- fontWeight: theme.fontWeight.medium,
496
- color: theme.colors.textMuted,
497
- marginBottom: 4,
498
- display: 'flex',
499
- alignItems: 'center',
500
- gap: 6,
501
- }}>
502
- {key}
503
- <span style={{
504
- fontSize: '10px',
505
- color: theme.dracula.purple,
506
- padding: '1px 6px',
507
- backgroundColor: theme.dracula.purple + '20',
508
- borderRadius: theme.borderRadius.sm,
509
- }}>
510
- [{value.length} items]
511
- </span>
512
- </div>
513
- <div>
514
- {/* Render first N array items with their index */}
515
- {value.slice(0, itemsToShow).map((item: any, index: number) => {
516
- const indexedPath = `${key}[${index}]`;
517
- const fullIndexedPath = path ? `${path}.${indexedPath}` : indexedPath;
518
-
519
- if (typeof item === 'object' && item !== null) {
520
- // Object item - render its properties with indexed path
521
- return (
522
- <div key={`${currentPath}[${index}]`} style={{
523
- marginLeft: 8,
524
- marginBottom: 8,
525
- padding: theme.spacing.xs,
526
- backgroundColor: theme.colors.backgroundElevated,
527
- borderRadius: theme.borderRadius.sm,
528
- border: `1px dashed ${theme.colors.border}`,
529
- }}>
530
- <div style={{
531
- fontSize: theme.fontSize.xs,
532
- fontWeight: theme.fontWeight.medium,
533
- color: theme.dracula.cyan,
534
- marginBottom: 4,
535
- }}>
536
- [{index}]
537
- </div>
538
- {Object.entries(item).map(([itemKey, itemValue]) => {
539
- const itemPath = `${fullIndexedPath}.${itemKey}`;
540
- // For nested objects within array items, render as draggable
541
- if (typeof itemValue === 'object' && itemValue !== null && !Array.isArray(itemValue)) {
542
- return (
543
- <div key={itemPath} style={{ marginLeft: 8, marginBottom: 4 }}>
544
- <div style={{
545
- fontSize: theme.fontSize.xs,
546
- color: theme.colors.textMuted,
547
- marginBottom: 2,
548
- }}>
549
- {itemKey}:
550
- </div>
551
- {Object.entries(itemValue as Record<string, any>).map(([nestedKey, nestedValue]) => (
552
- <div
553
- key={`${itemPath}.${nestedKey}`}
554
- draggable
555
- onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, `${itemPath}.${nestedKey}`, nestedValue)}
556
- style={{
557
- marginBottom: 4,
558
- marginLeft: 8,
559
- padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
560
- backgroundColor: theme.colors.backgroundAlt,
561
- border: `1px solid ${theme.colors.focus}`,
562
- borderRadius: theme.borderRadius.sm,
563
- cursor: 'grab',
564
- fontSize: theme.fontSize.xs,
565
- }}
566
- onMouseEnter={(e) => {
567
- e.currentTarget.style.backgroundColor = theme.colors.focusRing;
568
- e.currentTarget.style.borderColor = theme.dracula.cyan;
569
- }}
570
- onMouseLeave={(e) => {
571
- e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
572
- e.currentTarget.style.borderColor = theme.colors.focus;
573
- }}
574
- >
575
- <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
576
- {`{{${templateName}.${itemPath}.${nestedKey}}}`}
577
- </span>
578
- </div>
579
- ))}
580
- </div>
581
- );
582
- }
583
- // Primitive value in array item
584
- return (
585
- <div
586
- key={itemPath}
587
- draggable
588
- onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, itemPath, itemValue)}
589
- style={{
590
- marginBottom: 4,
591
- marginLeft: 8,
592
- padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
593
- backgroundColor: theme.colors.backgroundAlt,
594
- border: `1px solid ${theme.colors.focus}`,
595
- borderRadius: theme.borderRadius.sm,
596
- cursor: 'grab',
597
- fontSize: theme.fontSize.xs,
598
- }}
599
- onMouseEnter={(e) => {
600
- e.currentTarget.style.backgroundColor = theme.colors.focusRing;
601
- e.currentTarget.style.borderColor = theme.dracula.cyan;
602
- }}
603
- onMouseLeave={(e) => {
604
- e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
605
- e.currentTarget.style.borderColor = theme.colors.focus;
606
- }}
607
- >
608
- <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
609
- <div>
610
- <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
611
- {`{{${templateName}.${itemPath}}}`}
612
- </span>
613
- <span style={{ color: theme.colors.textMuted, marginLeft: 8 }}>
614
- {itemKey}: {typeof itemValue}
615
- </span>
616
- </div>
617
- <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke={theme.colors.templateVariable} strokeWidth="2">
618
- <line x1="12" y1="5" x2="12" y2="19"/>
619
- <polyline points="19 12 12 19 5 12"/>
620
- </svg>
621
- </div>
622
- </div>
623
- );
624
- })}
625
- </div>
626
- );
627
- } else {
628
- // Primitive array item
629
- return (
630
- <div
631
- key={`${currentPath}[${index}]`}
632
- draggable
633
- onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, fullIndexedPath, item)}
634
- style={{
635
- marginBottom: 4,
636
- marginLeft: 8,
637
- padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
638
- backgroundColor: theme.colors.backgroundAlt,
639
- border: `1px solid ${theme.colors.focus}`,
640
- borderRadius: theme.borderRadius.sm,
641
- cursor: 'grab',
642
- fontSize: theme.fontSize.xs,
643
- }}
644
- onMouseEnter={(e) => {
645
- e.currentTarget.style.backgroundColor = theme.colors.focusRing;
646
- e.currentTarget.style.borderColor = theme.dracula.cyan;
647
- }}
648
- onMouseLeave={(e) => {
649
- e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
650
- e.currentTarget.style.borderColor = theme.colors.focus;
651
- }}
652
- >
653
- <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
654
- {`{{${templateName}.${fullIndexedPath}}}`}
655
- </span>
656
- <span style={{ color: theme.colors.textMuted, marginLeft: 8 }}>
657
- [{index}]: {typeof item}
658
- </span>
659
- </div>
660
- );
661
- }
662
- })}
663
- {/* Show "and N more" if array has more items */}
664
- {value.length > maxArrayItems && (
665
- <div style={{
666
- marginLeft: 8,
667
- fontSize: theme.fontSize.xs,
668
- color: theme.colors.textMuted,
669
- fontStyle: 'italic',
670
- }}>
671
- ... and {value.length - maxArrayItems} more items
672
- </div>
673
- )}
674
- </div>
675
- </div>
676
- );
677
- }
678
-
679
- // Handle empty arrays
680
- if (isArray && value.length === 0) {
681
- return (
682
- <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
683
- <div style={{
684
- fontSize: theme.fontSize.xs,
685
- color: theme.colors.textMuted,
686
- }}>
687
- {key}: <span style={{ fontStyle: 'italic' }}>empty array</span>
688
- </div>
689
- </div>
690
- );
691
- }
692
-
693
- // Handle objects
694
- if (isObject) {
695
- return (
696
- <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
697
- <div style={{
698
- fontSize: theme.fontSize.xs,
699
- fontWeight: theme.fontWeight.medium,
700
- color: theme.colors.textMuted,
701
- marginBottom: 4,
702
- }}>
703
- {key}:
704
- </div>
705
- <div>
706
- {Object.entries(value as Record<string, any>).map(([subKey, subValue]) =>
707
- renderDraggableProperty(subKey, subValue, sourceNodeId, currentPath, depth + 1)
708
- )}
709
- </div>
710
- </div>
711
- );
712
- }
713
-
714
- const templateName = getTemplateVariableName(sourceNodeId);
715
- return (
716
- <div
717
- key={currentPath}
718
- draggable
719
- onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, currentPath, value)}
720
- style={{
721
- marginBottom: 8,
722
- marginLeft: depth > 0 ? 16 : 0,
723
- padding: theme.spacing.sm,
724
- backgroundColor: theme.colors.backgroundAlt,
725
- border: `1px solid ${theme.colors.focus}`,
726
- borderRadius: theme.borderRadius.md,
727
- cursor: 'grab',
728
- transition: theme.transitions.fast,
729
- }}
730
- onMouseEnter={(e) => {
731
- e.currentTarget.style.backgroundColor = theme.colors.focusRing;
732
- e.currentTarget.style.borderColor = theme.dracula.cyan;
733
- }}
734
- onMouseLeave={(e) => {
735
- e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
736
- e.currentTarget.style.borderColor = theme.colors.focus;
737
- }}
738
- >
739
- <div style={{
740
- display: 'flex',
741
- alignItems: 'center',
742
- justifyContent: 'space-between',
743
- }}>
744
- <div>
745
- <div style={{
746
- fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
747
- fontSize: theme.fontSize.sm,
748
- fontWeight: theme.fontWeight.medium,
749
- color: theme.colors.templateVariable,
750
- marginBottom: 2,
751
- }}>
752
- {`{{${templateName}.${currentPath}}}`}
753
- </div>
754
- <div style={{
755
- fontSize: theme.fontSize.xs,
756
- color: theme.colors.textSecondary,
757
- }}>
758
- {key}: {typeof value}
759
- </div>
760
- </div>
761
- {/* Drag icon */}
762
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke={theme.colors.templateVariable} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
763
- <line x1="12" y1="5" x2="12" y2="19"/>
764
- <polyline points="19 12 12 19 5 12"/>
765
- </svg>
766
- </div>
767
- </div>
768
- );
769
- };
770
-
771
- if (!visible) {
772
- return null;
773
- }
774
-
775
- // Loading state
776
- if (loading) {
777
- return (
778
- <div style={{
779
- width: '100%',
780
- height: '100%',
781
- backgroundColor: theme.colors.backgroundPanel,
782
- display: 'flex',
783
- flexDirection: 'column',
784
- alignItems: 'center',
785
- justifyContent: 'center',
786
- padding: theme.spacing.xxl,
787
- }}>
788
- <div style={{
789
- width: 32,
790
- height: 32,
791
- border: `3px solid ${theme.colors.border}`,
792
- borderTopColor: theme.dracula.cyan,
793
- borderRadius: '50%',
794
- animation: 'spin 1s linear infinite',
795
- marginBottom: theme.spacing.lg,
796
- }} />
797
- <style>
798
- {`@keyframes spin { to { transform: rotate(360deg); } }`}
799
- </style>
800
- <div style={{
801
- fontSize: theme.fontSize.sm,
802
- color: theme.colors.textSecondary,
803
- }}>
804
- Loading input data...
805
- </div>
806
- </div>
807
- );
808
- }
809
-
810
- // Empty state
811
- if (connectedNodes.length === 0) {
812
- return (
813
- <div style={{
814
- width: '100%',
815
- height: '100%',
816
- backgroundColor: theme.colors.backgroundPanel,
817
- display: 'flex',
818
- flexDirection: 'column',
819
- alignItems: 'center',
820
- justifyContent: 'center',
821
- padding: theme.spacing.xxl,
822
- }}>
823
- {/* Link icon */}
824
- <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke={theme.colors.textMuted} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ marginBottom: theme.spacing.lg }}>
825
- <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
826
- <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
827
- </svg>
828
- <div style={{
829
- fontSize: theme.fontSize.base,
830
- fontWeight: theme.fontWeight.medium,
831
- color: theme.colors.textSecondary,
832
- marginBottom: theme.spacing.xs,
833
- }}>
834
- No connected inputs
835
- </div>
836
- <div style={{
837
- fontSize: theme.fontSize.sm,
838
- color: theme.colors.textMuted,
839
- textAlign: 'center',
840
- }}>
841
- Connect nodes to see input data and available variables
842
- </div>
843
- </div>
844
- );
845
- }
846
-
847
- return (
848
- <div style={{
849
- width: '100%',
850
- height: '100%',
851
- backgroundColor: theme.colors.backgroundPanel,
852
- display: 'flex',
853
- flexDirection: 'column',
854
- overflow: 'hidden',
855
- }}>
856
- {/* Header */}
857
- <div style={{
858
- padding: `${theme.spacing.md} ${theme.spacing.lg}`,
859
- borderBottom: `1px solid ${theme.colors.border}`,
860
- backgroundColor: theme.colors.background,
861
- display: 'flex',
862
- alignItems: 'center',
863
- gap: theme.spacing.sm,
864
- flexShrink: 0,
865
- }}>
866
- {/* Database icon */}
867
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke={theme.colors.textSecondary} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
868
- <ellipse cx="12" cy="5" rx="9" ry="3"/>
869
- <path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
870
- <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
871
- </svg>
872
- <span style={{
873
- fontSize: theme.fontSize.sm,
874
- fontWeight: theme.fontWeight.semibold,
875
- color: theme.colors.text,
876
- }}>
877
- Input Data & Variables
878
- </span>
879
- <span style={{
880
- fontSize: theme.fontSize.xs,
881
- fontWeight: theme.fontWeight.medium,
882
- color: theme.dracula.cyan,
883
- padding: `2px ${theme.spacing.sm}`,
884
- backgroundColor: theme.dracula.cyan + '20',
885
- borderRadius: theme.borderRadius.sm,
886
- }}>
887
- {connectedNodes.length}
888
- </span>
889
- </div>
890
-
891
- {/* Content */}
892
- <div style={{
893
- flex: 1,
894
- overflow: 'auto',
895
- padding: theme.spacing.md,
896
- }}>
897
- {connectedNodes.map((node) => {
898
- const isExpanded = expandedNodes.has(node.id);
899
-
900
- return (
901
- <div key={node.id} style={{
902
- marginBottom: theme.spacing.md,
903
- backgroundColor: theme.colors.background,
904
- border: `1px solid ${theme.colors.border}`,
905
- borderLeft: `3px solid ${node.hasExecutionData ? theme.dracula.green : theme.dracula.orange}`,
906
- borderRadius: theme.borderRadius.md,
907
- overflow: 'hidden',
908
- }}>
909
- {/* Node Header */}
910
- <div
911
- onClick={() => toggleNode(node.id)}
912
- style={{
913
- padding: `${theme.spacing.sm} ${theme.spacing.md}`,
914
- backgroundColor: theme.colors.backgroundAlt,
915
- cursor: 'pointer',
916
- display: 'flex',
917
- alignItems: 'center',
918
- justifyContent: 'space-between',
919
- transition: theme.transitions.fast,
920
- }}
921
- >
922
- <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
923
- {renderNodeIcon(node.icon, 18)}
924
- <span style={{
925
- fontSize: theme.fontSize.sm,
926
- fontWeight: theme.fontWeight.semibold,
927
- color: theme.colors.text,
928
- }}>
929
- {node.name}
930
- </span>
931
- </div>
932
- <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
933
- {/* Status badge */}
934
- <span style={{
935
- fontSize: '10px',
936
- fontWeight: theme.fontWeight.medium,
937
- color: node.hasExecutionData ? theme.dracula.green : theme.dracula.orange,
938
- padding: `2px ${theme.spacing.xs}`,
939
- backgroundColor: node.hasExecutionData ? theme.dracula.green + '20' : theme.dracula.orange + '20',
940
- borderRadius: theme.borderRadius.sm,
941
- display: 'flex',
942
- alignItems: 'center',
943
- gap: 4,
944
- }}>
945
- {node.hasExecutionData ? (
946
- <svg width="10" height="10" viewBox="0 0 24 24" fill={theme.dracula.green} stroke="none">
947
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
948
- </svg>
949
- ) : (
950
- <svg width="10" height="10" viewBox="0 0 24 24" fill={theme.dracula.orange} stroke="none">
951
- <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
952
- </svg>
953
- )}
954
- {node.hasExecutionData ? 'LIVE' : 'SCHEMA'}
955
- </span>
956
- {/* Expand arrow */}
957
- <svg
958
- width="12"
959
- height="12"
960
- viewBox="0 0 24 24"
961
- fill="none"
962
- stroke={theme.colors.textSecondary}
963
- strokeWidth="2"
964
- strokeLinecap="round"
965
- strokeLinejoin="round"
966
- style={{
967
- transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)',
968
- transition: 'transform 0.2s ease',
969
- }}
970
- >
971
- <polyline points="6 9 12 15 18 9"/>
972
- </svg>
973
- </div>
974
- </div>
975
-
976
- {/* Node Content */}
977
- {isExpanded && (
978
- <div style={{
979
- padding: theme.spacing.md,
980
- borderTop: `1px solid ${theme.colors.border}`,
981
- }}>
982
- {/* Schema info banner */}
983
- {!node.hasExecutionData && (
984
- <div style={{
985
- display: 'flex',
986
- alignItems: 'center',
987
- gap: theme.spacing.sm,
988
- padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
989
- marginBottom: theme.spacing.md,
990
- backgroundColor: theme.dracula.cyan + '10',
991
- border: `1px solid ${theme.dracula.cyan}40`,
992
- borderRadius: theme.borderRadius.sm,
993
- fontSize: theme.fontSize.xs,
994
- color: theme.dracula.cyan,
995
- }}>
996
- <svg width="12" height="12" viewBox="0 0 24 24" fill={theme.dracula.cyan} stroke="none">
997
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
998
- </svg>
999
- Schema view - Execute this node to see actual input data
1000
- </div>
1001
- )}
1002
-
1003
- {/* Live data preview */}
1004
- {node.hasExecutionData && (
1005
- <div style={{ marginBottom: theme.spacing.md }}>
1006
- <div style={{
1007
- fontSize: theme.fontSize.xs,
1008
- fontWeight: theme.fontWeight.medium,
1009
- color: theme.colors.textMuted,
1010
- marginBottom: theme.spacing.xs,
1011
- textTransform: 'uppercase',
1012
- letterSpacing: '0.05em',
1013
- }}>
1014
- Received Data
1015
- </div>
1016
- <pre style={{
1017
- margin: 0,
1018
- padding: theme.spacing.sm,
1019
- fontSize: theme.fontSize.xs,
1020
- fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
1021
- backgroundColor: theme.colors.backgroundElevated,
1022
- border: `1px solid ${theme.colors.border}`,
1023
- borderRadius: theme.borderRadius.sm,
1024
- overflow: 'auto',
1025
- maxHeight: '120px',
1026
- whiteSpace: 'pre-wrap',
1027
- wordBreak: 'break-word',
1028
- color: theme.dracula.foreground,
1029
- }}>
1030
- {JSON.stringify(node.inputData, null, 2)}
1031
- </pre>
1032
- </div>
1033
- )}
1034
-
1035
- {/* Draggable variables */}
1036
- <div style={{
1037
- fontSize: theme.fontSize.xs,
1038
- fontWeight: theme.fontWeight.medium,
1039
- color: theme.colors.textMuted,
1040
- marginBottom: theme.spacing.sm,
1041
- textTransform: 'uppercase',
1042
- letterSpacing: '0.05em',
1043
- }}>
1044
- Drag Variables to Parameters
1045
- </div>
1046
- <div>
1047
- {typeof node.outputSchema === 'object' && node.outputSchema !== null
1048
- ? Object.entries(node.outputSchema).map(([key, value]) =>
1049
- renderDraggableProperty(key, value, node.id)
1050
- )
1051
- : (
1052
- <div style={{
1053
- fontSize: theme.fontSize.sm,
1054
- color: theme.colors.textMuted,
1055
- fontStyle: 'italic',
1056
- }}>
1057
- No variables available
1058
- </div>
1059
- )
1060
- }
1061
- </div>
1062
- </div>
1063
- )}
1064
- </div>
1065
- );
1066
- })}
1067
- </div>
1068
-
1069
- {/* Footer hint */}
1070
- <div style={{
1071
- padding: `${theme.spacing.sm} ${theme.spacing.lg}`,
1072
- borderTop: `1px solid ${theme.colors.border}`,
1073
- backgroundColor: theme.colors.background,
1074
- fontSize: theme.fontSize.xs,
1075
- color: theme.colors.textMuted,
1076
- textAlign: 'center',
1077
- flexShrink: 0,
1078
- display: 'flex',
1079
- alignItems: 'center',
1080
- justifyContent: 'center',
1081
- gap: theme.spacing.xs,
1082
- }}>
1083
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1084
- <circle cx="12" cy="12" r="10"/>
1085
- <line x1="12" y1="16" x2="12" y2="12"/>
1086
- <line x1="12" y1="8" x2="12.01" y2="8"/>
1087
- </svg>
1088
- Drag variables into parameter fields to use them
1089
- </div>
1090
- </div>
1091
- );
1092
- };
1093
-
1094
- export default InputSection;
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useAppStore } from '../../store/useAppStore';
3
+ import { nodeDefinitions } from '../../nodeDefinitions';
4
+ import { useWebSocket } from '../../contexts/WebSocketContext';
5
+ import { Node, Edge } from 'reactflow';
6
+ import { useDragVariable } from '../../hooks/useDragVariable';
7
+ import { useAppTheme } from '../../hooks/useAppTheme';
8
+
9
+ interface InputSectionProps {
10
+ nodeId: string;
11
+ visible?: boolean;
12
+ }
13
+
14
+ interface NodeData {
15
+ id: string;
16
+ name: string;
17
+ type: string;
18
+ icon: string;
19
+ inputData?: any;
20
+ outputSchema: Record<string, any>;
21
+ hasExecutionData: boolean;
22
+ }
23
+
24
+ // Helper to render icon (handles both image URLs and emoji/text)
25
+ const renderNodeIcon = (icon: string, size: number = 16) => {
26
+ if (icon.startsWith('data:') || icon.startsWith('http') || icon.startsWith('/')) {
27
+ return (
28
+ <img
29
+ src={icon}
30
+ alt="icon"
31
+ style={{ width: size, height: size, objectFit: 'contain' }}
32
+ />
33
+ );
34
+ }
35
+ return <span style={{ fontSize: size - 2 }}>{icon}</span>;
36
+ };
37
+
38
+ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) => {
39
+ const theme = useAppTheme();
40
+ const { currentWorkflow } = useAppStore();
41
+ const { getNodeOutput } = useWebSocket();
42
+ const [expandedNodes, setExpandedNodes] = useState<Set<string>>(new Set());
43
+ const [connectedNodes, setConnectedNodes] = useState<NodeData[]>([]);
44
+ const [loading, setLoading] = useState(false);
45
+ const { handleVariableDragStart, getTemplateVariableName } = useDragVariable(nodeId);
46
+
47
+ // Fetch connected node data with execution results from backend
48
+ useEffect(() => {
49
+ const fetchConnectedNodes = async () => {
50
+ if (!currentWorkflow || !nodeId) {
51
+ setConnectedNodes([]);
52
+ return;
53
+ }
54
+
55
+ setLoading(true);
56
+ const nodes = currentWorkflow.nodes || [];
57
+ const edges = currentWorkflow.edges || [];
58
+
59
+ // Helper to check if a handle is a config/auxiliary handle (not main data flow)
60
+ const isConfigHandle = (handle: string | null | undefined): boolean => {
61
+ if (!handle) return false;
62
+ // Config handles follow pattern: input-<type> where type is not 'main'
63
+ // Examples: input-memory, input-tools, input-model
64
+ if (handle.startsWith('input-') && handle !== 'input-main') {
65
+ return true;
66
+ }
67
+ return false;
68
+ };
69
+
70
+ // Helper to check if a node is a config/auxiliary node (connects to config handles)
71
+ const isConfigNode = (nodeType: string | undefined): boolean => {
72
+ if (!nodeType) return false;
73
+ const definition = nodeDefinitions[nodeType];
74
+ if (!definition) return false;
75
+ // Config nodes typically have 'memory' or 'tool' in their group
76
+ const groups = definition.group || [];
77
+ return groups.includes('memory') || groups.includes('tool');
78
+ };
79
+
80
+ // Get current node info
81
+ const currentNode = nodes.find((node: Node) => node.id === nodeId);
82
+ const currentNodeType = currentNode?.type;
83
+
84
+ // Collect all edges to process (direct + inherited from parent for config nodes)
85
+ interface EdgeWithLabel { edge: Edge; label?: string }
86
+ const edgesToProcess: EdgeWithLabel[] = [];
87
+
88
+ // 1. Add direct incoming edges (excluding config handle connections)
89
+ const directEdges = edges.filter((edge: Edge) => {
90
+ if (edge.target !== nodeId) return false;
91
+ if (isConfigHandle(edge.targetHandle)) return false;
92
+ return true;
93
+ });
94
+ directEdges.forEach(edge => edgesToProcess.push({ edge }));
95
+
96
+ // 2. If current node is a config node (memory, tool), inherit parent node's main inputs
97
+ if (isConfigNode(currentNodeType)) {
98
+ const outgoingEdges = edges.filter((edge: Edge) => edge.source === nodeId);
99
+
100
+ for (const outEdge of outgoingEdges) {
101
+ // Check if connected to a config handle on the target
102
+ if (isConfigHandle(outEdge.targetHandle)) {
103
+ const targetNode = nodes.find((node: Node) => node.id === outEdge.target);
104
+ if (!targetNode) continue;
105
+
106
+ const targetDef = nodeDefinitions[targetNode.type || ''];
107
+ const targetName = targetDef?.displayName || targetNode.type;
108
+
109
+ // Find nodes connected to the parent's main input (non-config handles)
110
+ const parentInputEdges = edges.filter(
111
+ (e: Edge) => e.target === targetNode.id && !isConfigHandle(e.targetHandle)
112
+ );
113
+
114
+ for (const parentEdge of parentInputEdges) {
115
+ edgesToProcess.push({ edge: parentEdge, label: `via ${targetName}` });
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ const nodeDataPromises = edgesToProcess.map(async ({ edge, label }) => {
122
+ const sourceNode = nodes.find((node: Node) => node.id === edge.source);
123
+ const nodeType = sourceNode?.type || '';
124
+ const nodeDef = nodeDefinitions[nodeType];
125
+
126
+ const executionData = await getNodeOutput(edge.source, 'output_0');
127
+ let inputData: any = null;
128
+ let outputSchema: Record<string, any>;
129
+ let hasExecutionData = false;
130
+
131
+ if (executionData && executionData[0] && executionData[0][0]) {
132
+ const rawData = executionData[0][0].json || executionData[0][0];
133
+ if (typeof rawData === 'object' && rawData !== null) {
134
+ inputData = rawData;
135
+ outputSchema = rawData;
136
+ hasExecutionData = true;
137
+ } else {
138
+ inputData = { value: rawData };
139
+ outputSchema = { value: typeof rawData };
140
+ hasExecutionData = true;
141
+ }
142
+ } else {
143
+ hasExecutionData = false;
144
+
145
+ if (nodeType === 'start') {
146
+ try {
147
+ const initialData = sourceNode?.data?.initialData || '{}';
148
+ outputSchema = typeof initialData === 'string' ? JSON.parse(initialData) : initialData;
149
+ } catch (e) {
150
+ outputSchema = {};
151
+ }
152
+ } else {
153
+ const sampleSchemas: Record<string, Record<string, any>> = {
154
+ location: { latitude: 'number', longitude: 'number', accuracy: 'number', provider: 'string', altitude: 'number' },
155
+ ai: { response: 'string', thinking: 'string', model: 'string', provider: 'string', finish_reason: 'string', timestamp: 'string' },
156
+ file: { fileName: 'string', fileSize: 'number' },
157
+ whatsapp: {
158
+ message_id: 'string',
159
+ sender: 'string',
160
+ sender_phone: 'string',
161
+ chat_id: 'string',
162
+ message_type: 'string',
163
+ text: 'string',
164
+ timestamp: 'string',
165
+ is_group: 'boolean',
166
+ is_from_me: 'boolean',
167
+ push_name: 'string',
168
+ media: 'object',
169
+ group_info: {
170
+ group_jid: 'string',
171
+ sender_jid: 'string',
172
+ sender_phone: 'string',
173
+ sender_name: 'string'
174
+ }
175
+ },
176
+ whatsappDb: {
177
+ // Output varies by operation - this shows chat_history output
178
+ operation: 'string',
179
+ // chat_history output
180
+ messages: [
181
+ {
182
+ text: 'string',
183
+ sender: 'string',
184
+ sender_phone: 'string',
185
+ message_type: 'string',
186
+ timestamp: 'string',
187
+ message_id: 'string',
188
+ is_from_me: 'boolean',
189
+ is_group: 'boolean',
190
+ push_name: 'string',
191
+ index: 'number'
192
+ }
193
+ ],
194
+ total: 'number',
195
+ has_more: 'boolean',
196
+ count: 'number',
197
+ chat_type: 'string',
198
+ // search_groups / list_contacts output
199
+ groups: [{ jid: 'string', name: 'string', participant_count: 'number' }],
200
+ contacts: [{ jid: 'string', phone: 'string', name: 'string', push_name: 'string' }],
201
+ // get_group_info output
202
+ participants: [{ jid: 'string', phone: 'string', name: 'string', is_admin: 'boolean' }],
203
+ // get_contact_info output
204
+ jid: 'string',
205
+ phone: 'string',
206
+ name: 'string',
207
+ push_name: 'string',
208
+ business_name: 'string',
209
+ is_business: 'boolean',
210
+ is_contact: 'boolean',
211
+ profile_pic: 'string',
212
+ timestamp: 'string'
213
+ },
214
+ webhook: {
215
+ method: 'string',
216
+ path: 'string',
217
+ headers: 'object',
218
+ query: 'object',
219
+ body: 'string',
220
+ json: 'object'
221
+ },
222
+ httpRequest: {
223
+ status: 'number',
224
+ data: 'any',
225
+ headers: 'object',
226
+ url: 'string',
227
+ method: 'string'
228
+ },
229
+ python: { output: 'any' },
230
+ javascript: { output: 'any' },
231
+ memory: {
232
+ session_id: 'string',
233
+ messages: 'array',
234
+ message_count: 'number',
235
+ memory_type: 'string',
236
+ window_size: 'number'
237
+ },
238
+ cronScheduler: {
239
+ timestamp: 'string',
240
+ iteration: 'number',
241
+ start_mode: 'string',
242
+ frequency: 'string',
243
+ timezone: 'string',
244
+ schedule: 'string',
245
+ scheduled_time: 'string',
246
+ triggered_at: 'string',
247
+ waited_seconds: 'number',
248
+ message: 'string'
249
+ },
250
+ // Android service schemas
251
+ android: {
252
+ service_id: 'string',
253
+ action: 'string',
254
+ data: 'object',
255
+ success: 'boolean'
256
+ },
257
+ batteryMonitor: {
258
+ battery_level: 'number',
259
+ is_charging: 'boolean',
260
+ temperature_celsius: 'number',
261
+ health: 'string',
262
+ voltage: 'number'
263
+ },
264
+ systemInfo: {
265
+ device_model: 'string',
266
+ android_version: 'string',
267
+ api_level: 'number',
268
+ manufacturer: 'string',
269
+ total_memory: 'number',
270
+ available_memory: 'number'
271
+ },
272
+ networkMonitor: {
273
+ connected: 'boolean',
274
+ type: 'string',
275
+ wifi_ssid: 'string',
276
+ ip_address: 'string'
277
+ },
278
+ wifiAutomation: {
279
+ wifi_enabled: 'boolean',
280
+ ssid: 'string',
281
+ ip_address: 'string',
282
+ signal_strength: 'number'
283
+ },
284
+ bluetoothAutomation: {
285
+ bluetooth_enabled: 'boolean',
286
+ paired_devices: 'array',
287
+ connected_devices: 'array'
288
+ },
289
+ audioAutomation: {
290
+ music_volume: 'number',
291
+ ring_volume: 'number',
292
+ muted: 'boolean'
293
+ },
294
+ androidLocation: {
295
+ latitude: 'number',
296
+ longitude: 'number',
297
+ accuracy: 'number',
298
+ provider: 'string',
299
+ altitude: 'number',
300
+ speed: 'number',
301
+ bearing: 'number'
302
+ },
303
+ appLauncher: {
304
+ package_name: 'string',
305
+ launched: 'boolean',
306
+ app_name: 'string'
307
+ },
308
+ appList: {
309
+ apps: 'array',
310
+ count: 'number'
311
+ },
312
+ deviceStateAutomation: {
313
+ airplane_mode: 'boolean',
314
+ screen_on: 'boolean',
315
+ brightness: 'number'
316
+ },
317
+ screenControlAutomation: {
318
+ brightness: 'number',
319
+ auto_brightness: 'boolean',
320
+ screen_timeout: 'number'
321
+ },
322
+ airplaneModeControl: {
323
+ airplane_mode_enabled: 'boolean'
324
+ },
325
+ motionDetection: {
326
+ accelerometer: { x: 'number', y: 'number', z: 'number' },
327
+ gyroscope: { x: 'number', y: 'number', z: 'number' },
328
+ motion_detected: 'boolean'
329
+ },
330
+ environmentalSensors: {
331
+ temperature: 'number',
332
+ humidity: 'number',
333
+ pressure: 'number',
334
+ light_level: 'number'
335
+ },
336
+ cameraControl: {
337
+ cameras: 'array',
338
+ photo_path: 'string',
339
+ success: 'boolean'
340
+ },
341
+ mediaControl: {
342
+ volume: 'number',
343
+ is_playing: 'boolean',
344
+ current_track: 'string'
345
+ },
346
+ chatTrigger: {
347
+ message: 'string',
348
+ timestamp: 'string',
349
+ session_id: 'string'
350
+ },
351
+ // Document processing schemas
352
+ httpScraper: {
353
+ items: 'array',
354
+ item_count: 'number',
355
+ errors: 'array'
356
+ },
357
+ fileDownloader: {
358
+ downloaded: 'number',
359
+ skipped: 'number',
360
+ failed: 'number',
361
+ files: 'array',
362
+ output_dir: 'string'
363
+ },
364
+ documentParser: {
365
+ documents: 'array',
366
+ parsed_count: 'number',
367
+ failed: 'array'
368
+ },
369
+ textChunker: {
370
+ chunks: 'array',
371
+ chunk_count: 'number'
372
+ },
373
+ embeddingGenerator: {
374
+ embeddings: 'array',
375
+ embedding_count: 'number',
376
+ dimensions: 'number',
377
+ chunks: 'array'
378
+ },
379
+ vectorStore: {
380
+ stored_count: 'number',
381
+ matches: 'array',
382
+ collection_name: 'string',
383
+ backend: 'string'
384
+ }
385
+ };
386
+
387
+ // Node type detection
388
+ const isMemory = nodeType === 'simpleMemory';
389
+ const nodeTypeLower = nodeType.toLowerCase();
390
+ const isAI = !isMemory && (nodeTypeLower.includes('chatmodel') || nodeTypeLower.includes('aiagent') || nodeTypeLower.includes('chatagent'));
391
+ const isFile = nodeType.includes('file');
392
+ const isWhatsAppDb = nodeType === 'whatsappDb';
393
+ const isWhatsApp = !isWhatsAppDb && (nodeType.includes('whatsapp') || nodeType.includes('Whatsapp'));
394
+ const isWebhook = nodeType === 'webhookTrigger';
395
+ const isHttpRequest = nodeType === 'httpRequest';
396
+ const isPython = nodeType.includes('python') || nodeType.includes('Python');
397
+ const isJavaScript = nodeType.includes('javascript') || nodeType.includes('Javascript');
398
+ const isCodeExecutor = isPython || isJavaScript;
399
+ const isCronScheduler = nodeType === 'cronScheduler';
400
+ const isChatTrigger = nodeType === 'chatTrigger';
401
+
402
+ // Document processing node detection
403
+ const documentNodeTypes = ['httpScraper', 'fileDownloader', 'documentParser', 'textChunker', 'embeddingGenerator', 'vectorStore'];
404
+ const isDocumentNode = documentNodeTypes.includes(nodeType);
405
+
406
+ // Android service node detection - check for specific Android node types
407
+ const androidNodeTypes = [
408
+ 'batteryMonitor', 'systemInfo', 'networkMonitor',
409
+ 'wifiAutomation', 'bluetoothAutomation', 'audioAutomation',
410
+ 'deviceStateAutomation', 'screenControlAutomation', 'airplaneModeControl',
411
+ 'motionDetection', 'environmentalSensors', 'cameraControl', 'mediaControl',
412
+ 'appLauncher', 'appList'
413
+ ];
414
+ const isAndroidNode = androidNodeTypes.includes(nodeType);
415
+ const isAndroidLocation = nodeType === 'location';
416
+
417
+ // Location nodes (Google Maps, not Android location)
418
+ const isLocationNode = nodeType.includes('location') && !isAndroidLocation;
419
+ const isGoogleMaps = nodeType === 'createMap' || nodeType === 'addLocations' || nodeType === 'showNearbyPlaces';
420
+
421
+ // Select appropriate schema
422
+ if (isAndroidLocation) {
423
+ outputSchema = sampleSchemas.androidLocation;
424
+ } else if (isAndroidNode && sampleSchemas[nodeType as keyof typeof sampleSchemas]) {
425
+ outputSchema = sampleSchemas[nodeType as keyof typeof sampleSchemas];
426
+ } else if (isDocumentNode && sampleSchemas[nodeType as keyof typeof sampleSchemas]) {
427
+ outputSchema = sampleSchemas[nodeType as keyof typeof sampleSchemas];
428
+ } else {
429
+ outputSchema = isLocationNode || isGoogleMaps ? sampleSchemas.location :
430
+ isMemory ? sampleSchemas.memory :
431
+ isAI ? sampleSchemas.ai :
432
+ isFile ? sampleSchemas.file :
433
+ isWhatsAppDb ? sampleSchemas.whatsappDb :
434
+ isWhatsApp ? sampleSchemas.whatsapp :
435
+ isWebhook ? sampleSchemas.webhook :
436
+ isHttpRequest ? sampleSchemas.httpRequest :
437
+ isCodeExecutor ? sampleSchemas.python :
438
+ isCronScheduler ? sampleSchemas.cronScheduler :
439
+ isChatTrigger ? sampleSchemas.chatTrigger :
440
+ { data: 'any' };
441
+ }
442
+ }
443
+ }
444
+
445
+ const baseName = sourceNode?.data?.label || nodeDef?.displayName || nodeType;
446
+ return {
447
+ id: edge.source,
448
+ name: label ? `${baseName} (${label})` : baseName,
449
+ type: nodeType,
450
+ icon: nodeDef?.icon || '',
451
+ inputData,
452
+ outputSchema,
453
+ hasExecutionData
454
+ };
455
+ });
456
+
457
+ const nodeDataResults = await Promise.all(nodeDataPromises);
458
+ setConnectedNodes(nodeDataResults);
459
+ // Auto-expand all nodes initially
460
+ setExpandedNodes(new Set(nodeDataResults.map(n => n.id)));
461
+ setLoading(false);
462
+ };
463
+
464
+ fetchConnectedNodes();
465
+ }, [nodeId, currentWorkflow, getNodeOutput]);
466
+
467
+ const toggleNode = (nodeId: string) => {
468
+ setExpandedNodes(prev => {
469
+ const next = new Set(prev);
470
+ if (next.has(nodeId)) {
471
+ next.delete(nodeId);
472
+ } else {
473
+ next.add(nodeId);
474
+ }
475
+ return next;
476
+ });
477
+ };
478
+
479
+ // Render draggable property
480
+ // NOTE: sourceNodeId is the unique node ID, used for template variable resolution
481
+ const renderDraggableProperty = (key: string, value: any, sourceNodeId: string, path: string = '', depth: number = 0, maxArrayItems: number = 3) => {
482
+ const currentPath = path ? `${path}.${key}` : key;
483
+ const isObject = typeof value === 'object' && value !== null && !Array.isArray(value);
484
+ const isArray = Array.isArray(value);
485
+
486
+ // Handle arrays - show indexed items
487
+ if (isArray && value.length > 0) {
488
+ const templateName = getTemplateVariableName(sourceNodeId);
489
+ const itemsToShow = Math.min(value.length, maxArrayItems);
490
+
491
+ return (
492
+ <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
493
+ <div style={{
494
+ fontSize: theme.fontSize.xs,
495
+ fontWeight: theme.fontWeight.medium,
496
+ color: theme.colors.textMuted,
497
+ marginBottom: 4,
498
+ display: 'flex',
499
+ alignItems: 'center',
500
+ gap: 6,
501
+ }}>
502
+ {key}
503
+ <span style={{
504
+ fontSize: '10px',
505
+ color: theme.dracula.purple,
506
+ padding: '1px 6px',
507
+ backgroundColor: theme.dracula.purple + '20',
508
+ borderRadius: theme.borderRadius.sm,
509
+ }}>
510
+ [{value.length} items]
511
+ </span>
512
+ </div>
513
+ <div>
514
+ {/* Render first N array items with their index */}
515
+ {value.slice(0, itemsToShow).map((item: any, index: number) => {
516
+ const indexedPath = `${key}[${index}]`;
517
+ const fullIndexedPath = path ? `${path}.${indexedPath}` : indexedPath;
518
+
519
+ if (typeof item === 'object' && item !== null) {
520
+ // Object item - render its properties with indexed path
521
+ return (
522
+ <div key={`${currentPath}[${index}]`} style={{
523
+ marginLeft: 8,
524
+ marginBottom: 8,
525
+ padding: theme.spacing.xs,
526
+ backgroundColor: theme.colors.backgroundElevated,
527
+ borderRadius: theme.borderRadius.sm,
528
+ border: `1px dashed ${theme.colors.border}`,
529
+ }}>
530
+ <div style={{
531
+ fontSize: theme.fontSize.xs,
532
+ fontWeight: theme.fontWeight.medium,
533
+ color: theme.dracula.cyan,
534
+ marginBottom: 4,
535
+ }}>
536
+ [{index}]
537
+ </div>
538
+ {Object.entries(item).map(([itemKey, itemValue]) => {
539
+ const itemPath = `${fullIndexedPath}.${itemKey}`;
540
+ // For nested objects within array items, render as draggable
541
+ if (typeof itemValue === 'object' && itemValue !== null && !Array.isArray(itemValue)) {
542
+ return (
543
+ <div key={itemPath} style={{ marginLeft: 8, marginBottom: 4 }}>
544
+ <div style={{
545
+ fontSize: theme.fontSize.xs,
546
+ color: theme.colors.textMuted,
547
+ marginBottom: 2,
548
+ }}>
549
+ {itemKey}:
550
+ </div>
551
+ {Object.entries(itemValue as Record<string, any>).map(([nestedKey, nestedValue]) => (
552
+ <div
553
+ key={`${itemPath}.${nestedKey}`}
554
+ draggable
555
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, `${itemPath}.${nestedKey}`, nestedValue)}
556
+ style={{
557
+ marginBottom: 4,
558
+ marginLeft: 8,
559
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
560
+ backgroundColor: theme.colors.backgroundAlt,
561
+ border: `1px solid ${theme.colors.focus}`,
562
+ borderRadius: theme.borderRadius.sm,
563
+ cursor: 'grab',
564
+ fontSize: theme.fontSize.xs,
565
+ }}
566
+ onMouseEnter={(e) => {
567
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
568
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
569
+ }}
570
+ onMouseLeave={(e) => {
571
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
572
+ e.currentTarget.style.borderColor = theme.colors.focus;
573
+ }}
574
+ >
575
+ <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
576
+ {`{{${templateName}.${itemPath}.${nestedKey}}}`}
577
+ </span>
578
+ </div>
579
+ ))}
580
+ </div>
581
+ );
582
+ }
583
+ // Primitive value in array item
584
+ return (
585
+ <div
586
+ key={itemPath}
587
+ draggable
588
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, itemPath, itemValue)}
589
+ style={{
590
+ marginBottom: 4,
591
+ marginLeft: 8,
592
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
593
+ backgroundColor: theme.colors.backgroundAlt,
594
+ border: `1px solid ${theme.colors.focus}`,
595
+ borderRadius: theme.borderRadius.sm,
596
+ cursor: 'grab',
597
+ fontSize: theme.fontSize.xs,
598
+ }}
599
+ onMouseEnter={(e) => {
600
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
601
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
602
+ }}
603
+ onMouseLeave={(e) => {
604
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
605
+ e.currentTarget.style.borderColor = theme.colors.focus;
606
+ }}
607
+ >
608
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
609
+ <div>
610
+ <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
611
+ {`{{${templateName}.${itemPath}}}`}
612
+ </span>
613
+ <span style={{ color: theme.colors.textMuted, marginLeft: 8 }}>
614
+ {itemKey}: {typeof itemValue}
615
+ </span>
616
+ </div>
617
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke={theme.colors.templateVariable} strokeWidth="2">
618
+ <line x1="12" y1="5" x2="12" y2="19"/>
619
+ <polyline points="19 12 12 19 5 12"/>
620
+ </svg>
621
+ </div>
622
+ </div>
623
+ );
624
+ })}
625
+ </div>
626
+ );
627
+ } else {
628
+ // Primitive array item
629
+ return (
630
+ <div
631
+ key={`${currentPath}[${index}]`}
632
+ draggable
633
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, fullIndexedPath, item)}
634
+ style={{
635
+ marginBottom: 4,
636
+ marginLeft: 8,
637
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
638
+ backgroundColor: theme.colors.backgroundAlt,
639
+ border: `1px solid ${theme.colors.focus}`,
640
+ borderRadius: theme.borderRadius.sm,
641
+ cursor: 'grab',
642
+ fontSize: theme.fontSize.xs,
643
+ }}
644
+ onMouseEnter={(e) => {
645
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
646
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
647
+ }}
648
+ onMouseLeave={(e) => {
649
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
650
+ e.currentTarget.style.borderColor = theme.colors.focus;
651
+ }}
652
+ >
653
+ <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
654
+ {`{{${templateName}.${fullIndexedPath}}}`}
655
+ </span>
656
+ <span style={{ color: theme.colors.textMuted, marginLeft: 8 }}>
657
+ [{index}]: {typeof item}
658
+ </span>
659
+ </div>
660
+ );
661
+ }
662
+ })}
663
+ {/* Show "and N more" if array has more items */}
664
+ {value.length > maxArrayItems && (
665
+ <div style={{
666
+ marginLeft: 8,
667
+ fontSize: theme.fontSize.xs,
668
+ color: theme.colors.textMuted,
669
+ fontStyle: 'italic',
670
+ }}>
671
+ ... and {value.length - maxArrayItems} more items
672
+ </div>
673
+ )}
674
+ </div>
675
+ </div>
676
+ );
677
+ }
678
+
679
+ // Handle empty arrays
680
+ if (isArray && value.length === 0) {
681
+ return (
682
+ <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
683
+ <div style={{
684
+ fontSize: theme.fontSize.xs,
685
+ color: theme.colors.textMuted,
686
+ }}>
687
+ {key}: <span style={{ fontStyle: 'italic' }}>empty array</span>
688
+ </div>
689
+ </div>
690
+ );
691
+ }
692
+
693
+ // Handle objects
694
+ if (isObject) {
695
+ return (
696
+ <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
697
+ <div style={{
698
+ fontSize: theme.fontSize.xs,
699
+ fontWeight: theme.fontWeight.medium,
700
+ color: theme.colors.textMuted,
701
+ marginBottom: 4,
702
+ }}>
703
+ {key}:
704
+ </div>
705
+ <div>
706
+ {Object.entries(value as Record<string, any>).map(([subKey, subValue]) =>
707
+ renderDraggableProperty(subKey, subValue, sourceNodeId, currentPath, depth + 1)
708
+ )}
709
+ </div>
710
+ </div>
711
+ );
712
+ }
713
+
714
+ const templateName = getTemplateVariableName(sourceNodeId);
715
+ return (
716
+ <div
717
+ key={currentPath}
718
+ draggable
719
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, currentPath, value)}
720
+ style={{
721
+ marginBottom: 8,
722
+ marginLeft: depth > 0 ? 16 : 0,
723
+ padding: theme.spacing.sm,
724
+ backgroundColor: theme.colors.backgroundAlt,
725
+ border: `1px solid ${theme.colors.focus}`,
726
+ borderRadius: theme.borderRadius.md,
727
+ cursor: 'grab',
728
+ transition: theme.transitions.fast,
729
+ }}
730
+ onMouseEnter={(e) => {
731
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
732
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
733
+ }}
734
+ onMouseLeave={(e) => {
735
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
736
+ e.currentTarget.style.borderColor = theme.colors.focus;
737
+ }}
738
+ >
739
+ <div style={{
740
+ display: 'flex',
741
+ alignItems: 'center',
742
+ justifyContent: 'space-between',
743
+ }}>
744
+ <div>
745
+ <div style={{
746
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
747
+ fontSize: theme.fontSize.sm,
748
+ fontWeight: theme.fontWeight.medium,
749
+ color: theme.colors.templateVariable,
750
+ marginBottom: 2,
751
+ }}>
752
+ {`{{${templateName}.${currentPath}}}`}
753
+ </div>
754
+ <div style={{
755
+ fontSize: theme.fontSize.xs,
756
+ color: theme.colors.textSecondary,
757
+ }}>
758
+ {key}: {typeof value}
759
+ </div>
760
+ </div>
761
+ {/* Drag icon */}
762
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke={theme.colors.templateVariable} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
763
+ <line x1="12" y1="5" x2="12" y2="19"/>
764
+ <polyline points="19 12 12 19 5 12"/>
765
+ </svg>
766
+ </div>
767
+ </div>
768
+ );
769
+ };
770
+
771
+ if (!visible) {
772
+ return null;
773
+ }
774
+
775
+ // Loading state
776
+ if (loading) {
777
+ return (
778
+ <div style={{
779
+ width: '100%',
780
+ height: '100%',
781
+ backgroundColor: theme.colors.backgroundPanel,
782
+ display: 'flex',
783
+ flexDirection: 'column',
784
+ alignItems: 'center',
785
+ justifyContent: 'center',
786
+ padding: theme.spacing.xxl,
787
+ }}>
788
+ <div style={{
789
+ width: 32,
790
+ height: 32,
791
+ border: `3px solid ${theme.colors.border}`,
792
+ borderTopColor: theme.dracula.cyan,
793
+ borderRadius: '50%',
794
+ animation: 'spin 1s linear infinite',
795
+ marginBottom: theme.spacing.lg,
796
+ }} />
797
+ <style>
798
+ {`@keyframes spin { to { transform: rotate(360deg); } }`}
799
+ </style>
800
+ <div style={{
801
+ fontSize: theme.fontSize.sm,
802
+ color: theme.colors.textSecondary,
803
+ }}>
804
+ Loading input data...
805
+ </div>
806
+ </div>
807
+ );
808
+ }
809
+
810
+ // Empty state
811
+ if (connectedNodes.length === 0) {
812
+ return (
813
+ <div style={{
814
+ width: '100%',
815
+ height: '100%',
816
+ backgroundColor: theme.colors.backgroundPanel,
817
+ display: 'flex',
818
+ flexDirection: 'column',
819
+ alignItems: 'center',
820
+ justifyContent: 'center',
821
+ padding: theme.spacing.xxl,
822
+ }}>
823
+ {/* Link icon */}
824
+ <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke={theme.colors.textMuted} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ marginBottom: theme.spacing.lg }}>
825
+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
826
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
827
+ </svg>
828
+ <div style={{
829
+ fontSize: theme.fontSize.base,
830
+ fontWeight: theme.fontWeight.medium,
831
+ color: theme.colors.textSecondary,
832
+ marginBottom: theme.spacing.xs,
833
+ }}>
834
+ No connected inputs
835
+ </div>
836
+ <div style={{
837
+ fontSize: theme.fontSize.sm,
838
+ color: theme.colors.textMuted,
839
+ textAlign: 'center',
840
+ }}>
841
+ Connect nodes to see input data and available variables
842
+ </div>
843
+ </div>
844
+ );
845
+ }
846
+
847
+ return (
848
+ <div style={{
849
+ width: '100%',
850
+ height: '100%',
851
+ backgroundColor: theme.colors.backgroundPanel,
852
+ display: 'flex',
853
+ flexDirection: 'column',
854
+ overflow: 'hidden',
855
+ }}>
856
+ {/* Header */}
857
+ <div style={{
858
+ padding: `${theme.spacing.md} ${theme.spacing.lg}`,
859
+ borderBottom: `1px solid ${theme.colors.border}`,
860
+ backgroundColor: theme.colors.background,
861
+ display: 'flex',
862
+ alignItems: 'center',
863
+ gap: theme.spacing.sm,
864
+ flexShrink: 0,
865
+ }}>
866
+ {/* Database icon */}
867
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke={theme.colors.textSecondary} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
868
+ <ellipse cx="12" cy="5" rx="9" ry="3"/>
869
+ <path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
870
+ <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
871
+ </svg>
872
+ <span style={{
873
+ fontSize: theme.fontSize.sm,
874
+ fontWeight: theme.fontWeight.semibold,
875
+ color: theme.colors.text,
876
+ }}>
877
+ Input Data & Variables
878
+ </span>
879
+ <span style={{
880
+ fontSize: theme.fontSize.xs,
881
+ fontWeight: theme.fontWeight.medium,
882
+ color: theme.dracula.cyan,
883
+ padding: `2px ${theme.spacing.sm}`,
884
+ backgroundColor: theme.dracula.cyan + '20',
885
+ borderRadius: theme.borderRadius.sm,
886
+ }}>
887
+ {connectedNodes.length}
888
+ </span>
889
+ </div>
890
+
891
+ {/* Content */}
892
+ <div style={{
893
+ flex: 1,
894
+ overflow: 'auto',
895
+ padding: theme.spacing.md,
896
+ }}>
897
+ {connectedNodes.map((node) => {
898
+ const isExpanded = expandedNodes.has(node.id);
899
+
900
+ return (
901
+ <div key={node.id} style={{
902
+ marginBottom: theme.spacing.md,
903
+ backgroundColor: theme.colors.background,
904
+ border: `1px solid ${theme.colors.border}`,
905
+ borderLeft: `3px solid ${node.hasExecutionData ? theme.dracula.green : theme.dracula.orange}`,
906
+ borderRadius: theme.borderRadius.md,
907
+ overflow: 'hidden',
908
+ }}>
909
+ {/* Node Header */}
910
+ <div
911
+ onClick={() => toggleNode(node.id)}
912
+ style={{
913
+ padding: `${theme.spacing.sm} ${theme.spacing.md}`,
914
+ backgroundColor: theme.colors.backgroundAlt,
915
+ cursor: 'pointer',
916
+ display: 'flex',
917
+ alignItems: 'center',
918
+ justifyContent: 'space-between',
919
+ transition: theme.transitions.fast,
920
+ }}
921
+ >
922
+ <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
923
+ {renderNodeIcon(node.icon, 18)}
924
+ <span style={{
925
+ fontSize: theme.fontSize.sm,
926
+ fontWeight: theme.fontWeight.semibold,
927
+ color: theme.colors.text,
928
+ }}>
929
+ {node.name}
930
+ </span>
931
+ </div>
932
+ <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
933
+ {/* Status badge */}
934
+ <span style={{
935
+ fontSize: '10px',
936
+ fontWeight: theme.fontWeight.medium,
937
+ color: node.hasExecutionData ? theme.dracula.green : theme.dracula.orange,
938
+ padding: `2px ${theme.spacing.xs}`,
939
+ backgroundColor: node.hasExecutionData ? theme.dracula.green + '20' : theme.dracula.orange + '20',
940
+ borderRadius: theme.borderRadius.sm,
941
+ display: 'flex',
942
+ alignItems: 'center',
943
+ gap: 4,
944
+ }}>
945
+ {node.hasExecutionData ? (
946
+ <svg width="10" height="10" viewBox="0 0 24 24" fill={theme.dracula.green} stroke="none">
947
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
948
+ </svg>
949
+ ) : (
950
+ <svg width="10" height="10" viewBox="0 0 24 24" fill={theme.dracula.orange} stroke="none">
951
+ <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
952
+ </svg>
953
+ )}
954
+ {node.hasExecutionData ? 'LIVE' : 'SCHEMA'}
955
+ </span>
956
+ {/* Expand arrow */}
957
+ <svg
958
+ width="12"
959
+ height="12"
960
+ viewBox="0 0 24 24"
961
+ fill="none"
962
+ stroke={theme.colors.textSecondary}
963
+ strokeWidth="2"
964
+ strokeLinecap="round"
965
+ strokeLinejoin="round"
966
+ style={{
967
+ transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)',
968
+ transition: 'transform 0.2s ease',
969
+ }}
970
+ >
971
+ <polyline points="6 9 12 15 18 9"/>
972
+ </svg>
973
+ </div>
974
+ </div>
975
+
976
+ {/* Node Content */}
977
+ {isExpanded && (
978
+ <div style={{
979
+ padding: theme.spacing.md,
980
+ borderTop: `1px solid ${theme.colors.border}`,
981
+ }}>
982
+ {/* Schema info banner */}
983
+ {!node.hasExecutionData && (
984
+ <div style={{
985
+ display: 'flex',
986
+ alignItems: 'center',
987
+ gap: theme.spacing.sm,
988
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
989
+ marginBottom: theme.spacing.md,
990
+ backgroundColor: theme.dracula.cyan + '10',
991
+ border: `1px solid ${theme.dracula.cyan}40`,
992
+ borderRadius: theme.borderRadius.sm,
993
+ fontSize: theme.fontSize.xs,
994
+ color: theme.dracula.cyan,
995
+ }}>
996
+ <svg width="12" height="12" viewBox="0 0 24 24" fill={theme.dracula.cyan} stroke="none">
997
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
998
+ </svg>
999
+ Schema view - Execute this node to see actual input data
1000
+ </div>
1001
+ )}
1002
+
1003
+ {/* Live data preview */}
1004
+ {node.hasExecutionData && (
1005
+ <div style={{ marginBottom: theme.spacing.md }}>
1006
+ <div style={{
1007
+ fontSize: theme.fontSize.xs,
1008
+ fontWeight: theme.fontWeight.medium,
1009
+ color: theme.colors.textMuted,
1010
+ marginBottom: theme.spacing.xs,
1011
+ textTransform: 'uppercase',
1012
+ letterSpacing: '0.05em',
1013
+ }}>
1014
+ Received Data
1015
+ </div>
1016
+ <pre style={{
1017
+ margin: 0,
1018
+ padding: theme.spacing.sm,
1019
+ fontSize: theme.fontSize.xs,
1020
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
1021
+ backgroundColor: theme.colors.backgroundElevated,
1022
+ border: `1px solid ${theme.colors.border}`,
1023
+ borderRadius: theme.borderRadius.sm,
1024
+ overflow: 'auto',
1025
+ maxHeight: '120px',
1026
+ whiteSpace: 'pre-wrap',
1027
+ wordBreak: 'break-word',
1028
+ color: theme.dracula.foreground,
1029
+ }}>
1030
+ {JSON.stringify(node.inputData, null, 2)}
1031
+ </pre>
1032
+ </div>
1033
+ )}
1034
+
1035
+ {/* Draggable variables */}
1036
+ <div style={{
1037
+ fontSize: theme.fontSize.xs,
1038
+ fontWeight: theme.fontWeight.medium,
1039
+ color: theme.colors.textMuted,
1040
+ marginBottom: theme.spacing.sm,
1041
+ textTransform: 'uppercase',
1042
+ letterSpacing: '0.05em',
1043
+ }}>
1044
+ Drag Variables to Parameters
1045
+ </div>
1046
+ <div>
1047
+ {typeof node.outputSchema === 'object' && node.outputSchema !== null
1048
+ ? Object.entries(node.outputSchema).map(([key, value]) =>
1049
+ renderDraggableProperty(key, value, node.id)
1050
+ )
1051
+ : (
1052
+ <div style={{
1053
+ fontSize: theme.fontSize.sm,
1054
+ color: theme.colors.textMuted,
1055
+ fontStyle: 'italic',
1056
+ }}>
1057
+ No variables available
1058
+ </div>
1059
+ )
1060
+ }
1061
+ </div>
1062
+ </div>
1063
+ )}
1064
+ </div>
1065
+ );
1066
+ })}
1067
+ </div>
1068
+
1069
+ {/* Footer hint */}
1070
+ <div style={{
1071
+ padding: `${theme.spacing.sm} ${theme.spacing.lg}`,
1072
+ borderTop: `1px solid ${theme.colors.border}`,
1073
+ backgroundColor: theme.colors.background,
1074
+ fontSize: theme.fontSize.xs,
1075
+ color: theme.colors.textMuted,
1076
+ textAlign: 'center',
1077
+ flexShrink: 0,
1078
+ display: 'flex',
1079
+ alignItems: 'center',
1080
+ justifyContent: 'center',
1081
+ gap: theme.spacing.xs,
1082
+ }}>
1083
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1084
+ <circle cx="12" cy="12" r="10"/>
1085
+ <line x1="12" y1="16" x2="12" y2="12"/>
1086
+ <line x1="12" y1="8" x2="12.01" y2="8"/>
1087
+ </svg>
1088
+ Drag variables into parameter fields to use them
1089
+ </div>
1090
+ </div>
1091
+ );
1092
+ };
1093
+
1094
+ export default InputSection;