machinaos 0.0.1 → 0.0.6

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 (420) hide show
  1. package/.env.template +71 -71
  2. package/LICENSE +21 -21
  3. package/README.md +145 -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/package.json +78 -70
  114. package/scripts/build.js +153 -45
  115. package/scripts/clean.js +40 -40
  116. package/scripts/start.js +234 -210
  117. package/scripts/stop.js +301 -325
  118. package/server/.dockerignore +44 -44
  119. package/server/Dockerfile +45 -45
  120. package/server/constants.py +244 -249
  121. package/server/core/cache.py +460 -460
  122. package/server/core/config.py +127 -127
  123. package/server/core/container.py +98 -98
  124. package/server/core/database.py +1296 -1210
  125. package/server/core/logging.py +313 -313
  126. package/server/main.py +288 -288
  127. package/server/middleware/__init__.py +5 -5
  128. package/server/middleware/auth.py +89 -89
  129. package/server/models/auth.py +52 -52
  130. package/server/models/cache.py +24 -24
  131. package/server/models/database.py +235 -210
  132. package/server/models/nodes.py +435 -455
  133. package/server/pyproject.toml +75 -72
  134. package/server/requirements.txt +83 -83
  135. package/server/routers/android.py +294 -294
  136. package/server/routers/auth.py +203 -203
  137. package/server/routers/database.py +150 -150
  138. package/server/routers/maps.py +141 -141
  139. package/server/routers/nodejs_compat.py +288 -288
  140. package/server/routers/webhook.py +90 -90
  141. package/server/routers/websocket.py +2239 -2127
  142. package/server/routers/whatsapp.py +761 -761
  143. package/server/routers/workflow.py +199 -199
  144. package/server/services/ai.py +2444 -2414
  145. package/server/services/android_service.py +588 -588
  146. package/server/services/auth.py +130 -130
  147. package/server/services/chat_client.py +160 -160
  148. package/server/services/deployment/manager.py +706 -706
  149. package/server/services/event_waiter.py +675 -785
  150. package/server/services/execution/executor.py +1351 -1351
  151. package/server/services/execution/models.py +1 -1
  152. package/server/services/handlers/__init__.py +122 -126
  153. package/server/services/handlers/ai.py +390 -355
  154. package/server/services/handlers/android.py +69 -260
  155. package/server/services/handlers/code.py +278 -278
  156. package/server/services/handlers/http.py +193 -193
  157. package/server/services/handlers/tools.py +146 -32
  158. package/server/services/handlers/triggers.py +107 -107
  159. package/server/services/handlers/utility.py +822 -822
  160. package/server/services/handlers/whatsapp.py +423 -476
  161. package/server/services/maps.py +288 -288
  162. package/server/services/memory_store.py +103 -103
  163. package/server/services/node_executor.py +372 -375
  164. package/server/services/scheduler.py +155 -155
  165. package/server/services/skill_loader.py +1 -1
  166. package/server/services/status_broadcaster.py +834 -826
  167. package/server/services/temporal/__init__.py +23 -23
  168. package/server/services/temporal/activities.py +344 -344
  169. package/server/services/temporal/client.py +76 -76
  170. package/server/services/temporal/executor.py +147 -147
  171. package/server/services/temporal/worker.py +251 -251
  172. package/server/services/temporal/workflow.py +355 -355
  173. package/server/services/temporal/ws_client.py +236 -236
  174. package/server/services/text.py +110 -110
  175. package/server/services/user_auth.py +172 -172
  176. package/server/services/websocket_client.py +29 -29
  177. package/server/services/workflow.py +597 -597
  178. package/server/skills/android-skill/SKILL.md +4 -4
  179. package/server/skills/code-skill/SKILL.md +123 -89
  180. package/server/skills/maps-skill/SKILL.md +3 -3
  181. package/server/skills/memory-skill/SKILL.md +1 -1
  182. package/server/skills/web-search-skill/SKILL.md +154 -0
  183. package/server/skills/whatsapp-skill/SKILL.md +3 -3
  184. package/server/uv.lock +461 -100
  185. package/server/whatsapp-rpc/.dockerignore +30 -30
  186. package/server/whatsapp-rpc/Dockerfile +44 -44
  187. package/server/whatsapp-rpc/Dockerfile.web +17 -17
  188. package/server/whatsapp-rpc/README.md +139 -139
  189. package/server/whatsapp-rpc/bin/whatsapp-rpc-server +0 -0
  190. package/server/whatsapp-rpc/cli.js +95 -95
  191. package/server/whatsapp-rpc/configs/config.yaml +6 -6
  192. package/server/whatsapp-rpc/docker-compose.yml +35 -35
  193. package/server/whatsapp-rpc/docs/API.md +410 -410
  194. package/server/whatsapp-rpc/node_modules/.package-lock.json +259 -0
  195. package/server/whatsapp-rpc/node_modules/chalk/license +9 -0
  196. package/server/whatsapp-rpc/node_modules/chalk/package.json +83 -0
  197. package/server/whatsapp-rpc/node_modules/chalk/readme.md +297 -0
  198. package/server/whatsapp-rpc/node_modules/chalk/source/index.d.ts +325 -0
  199. package/server/whatsapp-rpc/node_modules/chalk/source/index.js +225 -0
  200. package/server/whatsapp-rpc/node_modules/chalk/source/utilities.js +33 -0
  201. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  202. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  203. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  204. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
  205. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  206. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
  207. package/server/whatsapp-rpc/node_modules/commander/LICENSE +22 -0
  208. package/server/whatsapp-rpc/node_modules/commander/Readme.md +1148 -0
  209. package/server/whatsapp-rpc/node_modules/commander/esm.mjs +16 -0
  210. package/server/whatsapp-rpc/node_modules/commander/index.js +26 -0
  211. package/server/whatsapp-rpc/node_modules/commander/lib/argument.js +145 -0
  212. package/server/whatsapp-rpc/node_modules/commander/lib/command.js +2179 -0
  213. package/server/whatsapp-rpc/node_modules/commander/lib/error.js +43 -0
  214. package/server/whatsapp-rpc/node_modules/commander/lib/help.js +462 -0
  215. package/server/whatsapp-rpc/node_modules/commander/lib/option.js +329 -0
  216. package/server/whatsapp-rpc/node_modules/commander/lib/suggestSimilar.js +100 -0
  217. package/server/whatsapp-rpc/node_modules/commander/package-support.json +16 -0
  218. package/server/whatsapp-rpc/node_modules/commander/package.json +80 -0
  219. package/server/whatsapp-rpc/node_modules/commander/typings/esm.d.mts +3 -0
  220. package/server/whatsapp-rpc/node_modules/commander/typings/index.d.ts +884 -0
  221. package/server/whatsapp-rpc/node_modules/cross-spawn/LICENSE +21 -0
  222. package/server/whatsapp-rpc/node_modules/cross-spawn/README.md +89 -0
  223. package/server/whatsapp-rpc/node_modules/cross-spawn/index.js +39 -0
  224. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/enoent.js +59 -0
  225. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/parse.js +91 -0
  226. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/escape.js +47 -0
  227. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  228. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  229. package/server/whatsapp-rpc/node_modules/cross-spawn/package.json +73 -0
  230. package/server/whatsapp-rpc/node_modules/execa/index.d.ts +955 -0
  231. package/server/whatsapp-rpc/node_modules/execa/index.js +309 -0
  232. package/server/whatsapp-rpc/node_modules/execa/lib/command.js +119 -0
  233. package/server/whatsapp-rpc/node_modules/execa/lib/error.js +87 -0
  234. package/server/whatsapp-rpc/node_modules/execa/lib/kill.js +102 -0
  235. package/server/whatsapp-rpc/node_modules/execa/lib/pipe.js +42 -0
  236. package/server/whatsapp-rpc/node_modules/execa/lib/promise.js +36 -0
  237. package/server/whatsapp-rpc/node_modules/execa/lib/stdio.js +49 -0
  238. package/server/whatsapp-rpc/node_modules/execa/lib/stream.js +133 -0
  239. package/server/whatsapp-rpc/node_modules/execa/lib/verbose.js +19 -0
  240. package/server/whatsapp-rpc/node_modules/execa/license +9 -0
  241. package/server/whatsapp-rpc/node_modules/execa/package.json +90 -0
  242. package/server/whatsapp-rpc/node_modules/execa/readme.md +822 -0
  243. package/server/whatsapp-rpc/node_modules/get-stream/license +9 -0
  244. package/server/whatsapp-rpc/node_modules/get-stream/package.json +53 -0
  245. package/server/whatsapp-rpc/node_modules/get-stream/readme.md +291 -0
  246. package/server/whatsapp-rpc/node_modules/get-stream/source/array-buffer.js +84 -0
  247. package/server/whatsapp-rpc/node_modules/get-stream/source/array.js +32 -0
  248. package/server/whatsapp-rpc/node_modules/get-stream/source/buffer.js +20 -0
  249. package/server/whatsapp-rpc/node_modules/get-stream/source/contents.js +101 -0
  250. package/server/whatsapp-rpc/node_modules/get-stream/source/index.d.ts +119 -0
  251. package/server/whatsapp-rpc/node_modules/get-stream/source/index.js +5 -0
  252. package/server/whatsapp-rpc/node_modules/get-stream/source/string.js +36 -0
  253. package/server/whatsapp-rpc/node_modules/get-stream/source/utils.js +11 -0
  254. package/server/whatsapp-rpc/node_modules/get-them-args/LICENSE +21 -0
  255. package/server/whatsapp-rpc/node_modules/get-them-args/README.md +95 -0
  256. package/server/whatsapp-rpc/node_modules/get-them-args/index.js +97 -0
  257. package/server/whatsapp-rpc/node_modules/get-them-args/package.json +36 -0
  258. package/server/whatsapp-rpc/node_modules/human-signals/LICENSE +201 -0
  259. package/server/whatsapp-rpc/node_modules/human-signals/README.md +168 -0
  260. package/server/whatsapp-rpc/node_modules/human-signals/build/src/core.js +273 -0
  261. package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.d.ts +73 -0
  262. package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.js +70 -0
  263. package/server/whatsapp-rpc/node_modules/human-signals/build/src/realtime.js +16 -0
  264. package/server/whatsapp-rpc/node_modules/human-signals/build/src/signals.js +34 -0
  265. package/server/whatsapp-rpc/node_modules/human-signals/package.json +61 -0
  266. package/server/whatsapp-rpc/node_modules/is-stream/index.d.ts +81 -0
  267. package/server/whatsapp-rpc/node_modules/is-stream/index.js +29 -0
  268. package/server/whatsapp-rpc/node_modules/is-stream/license +9 -0
  269. package/server/whatsapp-rpc/node_modules/is-stream/package.json +44 -0
  270. package/server/whatsapp-rpc/node_modules/is-stream/readme.md +60 -0
  271. package/server/whatsapp-rpc/node_modules/isexe/LICENSE +15 -0
  272. package/server/whatsapp-rpc/node_modules/isexe/README.md +51 -0
  273. package/server/whatsapp-rpc/node_modules/isexe/index.js +57 -0
  274. package/server/whatsapp-rpc/node_modules/isexe/mode.js +41 -0
  275. package/server/whatsapp-rpc/node_modules/isexe/package.json +31 -0
  276. package/server/whatsapp-rpc/node_modules/isexe/test/basic.js +221 -0
  277. package/server/whatsapp-rpc/node_modules/isexe/windows.js +42 -0
  278. package/server/whatsapp-rpc/node_modules/kill-port/.editorconfig +12 -0
  279. package/server/whatsapp-rpc/node_modules/kill-port/.gitattributes +1 -0
  280. package/server/whatsapp-rpc/node_modules/kill-port/LICENSE +21 -0
  281. package/server/whatsapp-rpc/node_modules/kill-port/README.md +140 -0
  282. package/server/whatsapp-rpc/node_modules/kill-port/cli.js +25 -0
  283. package/server/whatsapp-rpc/node_modules/kill-port/example.js +21 -0
  284. package/server/whatsapp-rpc/node_modules/kill-port/index.js +46 -0
  285. package/server/whatsapp-rpc/node_modules/kill-port/logo.png +0 -0
  286. package/server/whatsapp-rpc/node_modules/kill-port/package.json +41 -0
  287. package/server/whatsapp-rpc/node_modules/kill-port/pnpm-lock.yaml +4606 -0
  288. package/server/whatsapp-rpc/node_modules/kill-port/test.js +16 -0
  289. package/server/whatsapp-rpc/node_modules/merge-stream/LICENSE +21 -0
  290. package/server/whatsapp-rpc/node_modules/merge-stream/README.md +78 -0
  291. package/server/whatsapp-rpc/node_modules/merge-stream/index.js +41 -0
  292. package/server/whatsapp-rpc/node_modules/merge-stream/package.json +19 -0
  293. package/server/whatsapp-rpc/node_modules/mimic-fn/index.d.ts +52 -0
  294. package/server/whatsapp-rpc/node_modules/mimic-fn/index.js +71 -0
  295. package/server/whatsapp-rpc/node_modules/mimic-fn/license +9 -0
  296. package/server/whatsapp-rpc/node_modules/mimic-fn/package.json +45 -0
  297. package/server/whatsapp-rpc/node_modules/mimic-fn/readme.md +90 -0
  298. package/server/whatsapp-rpc/node_modules/npm-run-path/index.d.ts +90 -0
  299. package/server/whatsapp-rpc/node_modules/npm-run-path/index.js +52 -0
  300. package/server/whatsapp-rpc/node_modules/npm-run-path/license +9 -0
  301. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.d.ts +31 -0
  302. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.js +12 -0
  303. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/license +9 -0
  304. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/package.json +41 -0
  305. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/readme.md +57 -0
  306. package/server/whatsapp-rpc/node_modules/npm-run-path/package.json +49 -0
  307. package/server/whatsapp-rpc/node_modules/npm-run-path/readme.md +104 -0
  308. package/server/whatsapp-rpc/node_modules/onetime/index.d.ts +59 -0
  309. package/server/whatsapp-rpc/node_modules/onetime/index.js +41 -0
  310. package/server/whatsapp-rpc/node_modules/onetime/license +9 -0
  311. package/server/whatsapp-rpc/node_modules/onetime/package.json +45 -0
  312. package/server/whatsapp-rpc/node_modules/onetime/readme.md +94 -0
  313. package/server/whatsapp-rpc/node_modules/path-key/index.d.ts +40 -0
  314. package/server/whatsapp-rpc/node_modules/path-key/index.js +16 -0
  315. package/server/whatsapp-rpc/node_modules/path-key/license +9 -0
  316. package/server/whatsapp-rpc/node_modules/path-key/package.json +39 -0
  317. package/server/whatsapp-rpc/node_modules/path-key/readme.md +61 -0
  318. package/server/whatsapp-rpc/node_modules/shebang-command/index.js +19 -0
  319. package/server/whatsapp-rpc/node_modules/shebang-command/license +9 -0
  320. package/server/whatsapp-rpc/node_modules/shebang-command/package.json +34 -0
  321. package/server/whatsapp-rpc/node_modules/shebang-command/readme.md +34 -0
  322. package/server/whatsapp-rpc/node_modules/shebang-regex/index.d.ts +22 -0
  323. package/server/whatsapp-rpc/node_modules/shebang-regex/index.js +2 -0
  324. package/server/whatsapp-rpc/node_modules/shebang-regex/license +9 -0
  325. package/server/whatsapp-rpc/node_modules/shebang-regex/package.json +35 -0
  326. package/server/whatsapp-rpc/node_modules/shebang-regex/readme.md +33 -0
  327. package/server/whatsapp-rpc/node_modules/shell-exec/LICENSE +21 -0
  328. package/server/whatsapp-rpc/node_modules/shell-exec/README.md +60 -0
  329. package/server/whatsapp-rpc/node_modules/shell-exec/index.js +47 -0
  330. package/server/whatsapp-rpc/node_modules/shell-exec/package.json +29 -0
  331. package/server/whatsapp-rpc/node_modules/signal-exit/LICENSE.txt +16 -0
  332. package/server/whatsapp-rpc/node_modules/signal-exit/README.md +74 -0
  333. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
  334. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
  335. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js +10 -0
  336. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
  337. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
  338. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
  339. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js +279 -0
  340. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
  341. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/package.json +3 -0
  342. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
  343. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
  344. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js +42 -0
  345. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
  346. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
  347. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
  348. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js +4 -0
  349. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
  350. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
  351. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
  352. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js +275 -0
  353. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
  354. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/package.json +3 -0
  355. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
  356. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
  357. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js +39 -0
  358. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
  359. package/server/whatsapp-rpc/node_modules/signal-exit/package.json +106 -0
  360. package/server/whatsapp-rpc/node_modules/strip-final-newline/index.js +14 -0
  361. package/server/whatsapp-rpc/node_modules/strip-final-newline/license +9 -0
  362. package/server/whatsapp-rpc/node_modules/strip-final-newline/package.json +43 -0
  363. package/server/whatsapp-rpc/node_modules/strip-final-newline/readme.md +35 -0
  364. package/server/whatsapp-rpc/node_modules/which/CHANGELOG.md +166 -0
  365. package/server/whatsapp-rpc/node_modules/which/LICENSE +15 -0
  366. package/server/whatsapp-rpc/node_modules/which/README.md +54 -0
  367. package/server/whatsapp-rpc/node_modules/which/bin/node-which +52 -0
  368. package/server/whatsapp-rpc/node_modules/which/package.json +43 -0
  369. package/server/whatsapp-rpc/node_modules/which/which.js +125 -0
  370. package/server/whatsapp-rpc/package-lock.json +272 -0
  371. package/server/whatsapp-rpc/package.json +30 -30
  372. package/server/whatsapp-rpc/schema.json +1294 -1294
  373. package/server/whatsapp-rpc/scripts/clean.cjs +66 -66
  374. package/server/whatsapp-rpc/scripts/cli.js +162 -162
  375. package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -166
  376. package/server/whatsapp-rpc/src/python/pyproject.toml +15 -15
  377. package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -4
  378. package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -427
  379. package/server/whatsapp-rpc/web/app.py +609 -609
  380. package/server/whatsapp-rpc/web/requirements.txt +6 -6
  381. package/server/whatsapp-rpc/web/rpc_client.py +427 -427
  382. package/server/whatsapp-rpc/web/static/openapi.yaml +59 -59
  383. package/server/whatsapp-rpc/web/templates/base.html +149 -149
  384. package/server/whatsapp-rpc/web/templates/contacts.html +240 -240
  385. package/server/whatsapp-rpc/web/templates/dashboard.html +319 -319
  386. package/server/whatsapp-rpc/web/templates/groups.html +328 -328
  387. package/server/whatsapp-rpc/web/templates/messages.html +465 -465
  388. package/server/whatsapp-rpc/web/templates/messaging.html +680 -680
  389. package/server/whatsapp-rpc/web/templates/send.html +258 -258
  390. package/server/whatsapp-rpc/web/templates/settings.html +459 -459
  391. package/client/src/components/ui/AndroidSettingsPanel.tsx +0 -401
  392. package/client/src/components/ui/WhatsAppSettingsPanel.tsx +0 -345
  393. package/client/src/nodeDefinitions/androidDeviceNodes.ts +0 -140
  394. package/docker-compose.prod.yml +0 -107
  395. package/docker-compose.yml +0 -104
  396. package/docs-MachinaOs/README.md +0 -85
  397. package/docs-MachinaOs/deployment/docker.mdx +0 -228
  398. package/docs-MachinaOs/deployment/production.mdx +0 -345
  399. package/docs-MachinaOs/docs.json +0 -75
  400. package/docs-MachinaOs/faq.mdx +0 -309
  401. package/docs-MachinaOs/favicon.svg +0 -5
  402. package/docs-MachinaOs/installation.mdx +0 -160
  403. package/docs-MachinaOs/introduction.mdx +0 -114
  404. package/docs-MachinaOs/logo/dark.svg +0 -6
  405. package/docs-MachinaOs/logo/light.svg +0 -6
  406. package/docs-MachinaOs/nodes/ai-agent.mdx +0 -216
  407. package/docs-MachinaOs/nodes/ai-models.mdx +0 -240
  408. package/docs-MachinaOs/nodes/android.mdx +0 -411
  409. package/docs-MachinaOs/nodes/overview.mdx +0 -181
  410. package/docs-MachinaOs/nodes/schedulers.mdx +0 -316
  411. package/docs-MachinaOs/nodes/webhooks.mdx +0 -330
  412. package/docs-MachinaOs/nodes/whatsapp.mdx +0 -305
  413. package/docs-MachinaOs/quickstart.mdx +0 -119
  414. package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +0 -177
  415. package/docs-MachinaOs/tutorials/android-automation.mdx +0 -242
  416. package/docs-MachinaOs/tutorials/first-workflow.mdx +0 -134
  417. package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +0 -185
  418. package/nul +0 -0
  419. package/scripts/check-ports.ps1 +0 -33
  420. package/scripts/kill-port.ps1 +0 -154
@@ -1,571 +1,867 @@
1
- import React, { useState, useEffect } from 'react';
2
- import ParameterRenderer from '../ParameterRenderer';
3
- import ToolSchemaEditor from './ToolSchemaEditor';
4
- import { useAppTheme } from '../../hooks/useAppTheme';
5
- import { useAppStore } from '../../store/useAppStore';
6
- import { nodeDefinitions } from '../../nodeDefinitions';
7
- import { INodeTypeDescription, INodeProperties } from '../../types/INodeProperties';
8
- import { ExecutionResult } from '../../services/executionService';
9
- import { Edge } from 'reactflow';
10
- import { SKILL_NODE_TYPES } from '../../nodeDefinitions/skillNodes';
11
-
12
- // Tool node types that support schema editing
13
- const TOOL_NODE_TYPES = ['androidTool', 'calculatorTool', 'currentTimeTool', 'webSearchTool'];
14
-
15
- interface ConnectedSkill {
16
- id: string;
17
- name: string;
18
- type: string;
19
- icon: string;
20
- description: string;
21
- color: string;
22
- }
23
-
24
- interface MiddleSectionProps {
25
- nodeId: string;
26
- nodeDefinition: INodeTypeDescription;
27
- parameters: Record<string, any>;
28
- onParameterChange: (paramName: string, value: any) => void;
29
- isLoadingParameters?: boolean;
30
- executionResults?: ExecutionResult[];
31
- }
32
-
33
- const shouldShowParameter = (param: INodeProperties, allParameters: Record<string, any>): boolean => {
34
- if (!param.displayOptions?.show) {
35
- return true;
36
- }
37
-
38
- const showConditions = param.displayOptions.show;
39
-
40
- for (const [paramName, allowedValues] of Object.entries(showConditions)) {
41
- const currentValue = allParameters[paramName];
42
-
43
- if (Array.isArray(allowedValues)) {
44
- if (!allowedValues.includes(currentValue)) {
45
- return false;
46
- }
47
- } else {
48
- if (currentValue !== allowedValues) {
49
- return false;
50
- }
51
- }
52
- }
53
-
54
- return true;
55
- };
56
-
57
- const MiddleSection: React.FC<MiddleSectionProps> = ({
58
- nodeId,
59
- nodeDefinition,
60
- parameters,
61
- onParameterChange,
62
- isLoadingParameters = false,
63
- executionResults = []
64
- }) => {
65
- const theme = useAppTheme();
66
- const { currentWorkflow } = useAppStore();
67
- const [isConsoleExpanded, setIsConsoleExpanded] = useState(true);
68
- const [connectedSkills, setConnectedSkills] = useState<ConnectedSkill[]>([]);
69
- const [isSkillsExpanded, setIsSkillsExpanded] = useState(true);
70
-
71
- const visibleParams = (nodeDefinition.properties || [])
72
- .filter((param: INodeProperties) => shouldShowParameter(param, parameters));
73
-
74
- // Check if this is a code executor node (Python or JavaScript)
75
- const isCodeExecutorNode = nodeDefinition.name === 'pythonExecutor' || nodeDefinition.name === 'javascriptExecutor';
76
-
77
- // Check if this is a skill node with code editor (needs similar flex layout)
78
- const isSkillNode = SKILL_NODE_TYPES.includes(nodeDefinition.name) && nodeDefinition.name !== 'customSkill';
79
-
80
- // Check if this is a memory node with markdown editor
81
- const isMemoryNode = nodeDefinition.name === 'simpleMemory';
82
-
83
- // Nodes that need flexible code editor layout
84
- const needsCodeEditorLayout = isCodeExecutorNode || isSkillNode || isMemoryNode;
85
-
86
- // Check if this is a tool node that supports schema editing
87
- const isToolNode = TOOL_NODE_TYPES.includes(nodeDefinition.name);
88
-
89
- // Check if this is a Chat Agent node
90
- const isChatAgentNode = nodeDefinition.name === 'chatAgent';
91
-
92
- // Get connected skills for Chat Agent nodes
93
- useEffect(() => {
94
- if (!isChatAgentNode || !currentWorkflow) {
95
- setConnectedSkills([]);
96
- return;
97
- }
98
-
99
- const nodes = currentWorkflow.nodes || [];
100
- const edges = currentWorkflow.edges || [];
101
-
102
- // Find edges connecting to this node's input-skill handle
103
- const skillEdges = edges.filter((edge: Edge) =>
104
- edge.target === nodeId && edge.targetHandle === 'input-skill'
105
- );
106
-
107
- // Get skill node data
108
- const skills: ConnectedSkill[] = skillEdges.map((edge: Edge) => {
109
- const sourceNode = nodes.find((n: any) => n.id === edge.source);
110
- const nodeType = sourceNode?.type || '';
111
- const nodeDef = nodeDefinitions[nodeType];
112
-
113
- return {
114
- id: edge.source,
115
- name: sourceNode?.data?.label || nodeDef?.displayName || nodeType,
116
- type: nodeType,
117
- icon: nodeDef?.icon || '',
118
- description: nodeDef?.description || '',
119
- color: nodeDef?.defaults?.color as string || '#6366F1',
120
- };
121
- });
122
-
123
- setConnectedSkills(skills);
124
- }, [nodeId, isChatAgentNode, currentWorkflow]);
125
-
126
- // Extract console output from execution results
127
- const getConsoleOutput = (): string => {
128
- if (executionResults.length === 0) return '';
129
-
130
- const latestResult = executionResults[0];
131
- const outputs = latestResult.outputs || latestResult.data || latestResult.nodeData?.[0]?.[0]?.json;
132
-
133
- if (!outputs) return '';
134
-
135
- // Check for console_output or stdout in the result
136
- if (outputs.console_output) return outputs.console_output;
137
- if (outputs.stdout) return outputs.stdout;
138
- if (outputs.result?.console_output) return outputs.result.console_output;
139
- if (outputs.result?.stdout) return outputs.result.stdout;
140
-
141
- // Check for error output
142
- if (latestResult.error) return `Error: ${latestResult.error}`;
143
- if (outputs.error) return `Error: ${outputs.error}`;
144
- if (outputs.stderr) return `Error: ${outputs.stderr}`;
145
-
146
- return '';
147
- };
148
-
149
- const consoleOutput = isCodeExecutorNode ? getConsoleOutput() : '';
150
-
151
- return (
152
- <div style={{
153
- flex: 1,
154
- display: 'flex',
155
- flexDirection: 'column',
156
- height: '100%',
157
- overflow: 'hidden',
158
- position: 'relative'
159
- }}>
160
- {/* Description - hide for code editor nodes (Python, Skill) */}
161
- {!needsCodeEditorLayout && (
162
- <div style={{
163
- padding: `${theme.spacing.lg} ${theme.spacing.xl} ${theme.spacing.sm}`,
164
- borderBottom: `1px solid ${theme.colors.border}`,
165
- backgroundColor: theme.colors.backgroundAlt,
166
- flexShrink: 0
167
- }}>
168
- <p style={{
169
- margin: 0,
170
- fontSize: theme.fontSize.base,
171
- color: theme.colors.textSecondary,
172
- lineHeight: '1.5',
173
- }}>
174
- {nodeDefinition.description}
175
- </p>
176
- </div>
177
- )}
178
-
179
- {/* Main Content Area - Flexible */}
180
- <div style={{ flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, overflow: 'hidden' }}>
181
- {/* Parameters */}
182
- <div style={{
183
- padding: theme.spacing.xl,
184
- flex: needsCodeEditorLayout ? '3' : 1,
185
- overflowY: needsCodeEditorLayout ? 'hidden' : 'auto',
186
- overflowX: 'hidden',
187
- width: '100%',
188
- boxSizing: 'border-box',
189
- minHeight: 0,
190
- display: needsCodeEditorLayout ? 'flex' : 'block',
191
- flexDirection: 'column'
192
- }}>
193
- {/* Parameters Container */}
194
- <div style={{
195
- backgroundColor: theme.colors.background,
196
- border: `1px solid ${theme.colors.border}`,
197
- borderRadius: theme.borderRadius.md,
198
- padding: theme.spacing.lg,
199
- boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
200
- height: needsCodeEditorLayout ? '100%' : 'auto',
201
- display: needsCodeEditorLayout ? 'flex' : 'block',
202
- flexDirection: 'column',
203
- boxSizing: 'border-box'
204
- }}>
205
- {/* All Parameters - standard n8n style */}
206
- {visibleParams.map((param: INodeProperties, index: number) => {
207
- // Check if this parameter is a code editor - give it more flex space
208
- const isCodeParam = (param as any).typeOptions?.editor === 'code';
209
- return (
210
- <div
211
- key={param.name}
212
- style={{
213
- paddingBottom: index < visibleParams.length - 1 ? theme.spacing.md : 0,
214
- marginBottom: index < visibleParams.length - 1 ? theme.spacing.md : 0,
215
- borderBottom: index < visibleParams.length - 1 ? `1px solid ${theme.colors.border}` : 'none',
216
- flex: needsCodeEditorLayout && isCodeParam ? 1 : 'none',
217
- display: needsCodeEditorLayout ? 'flex' : 'block',
218
- flexDirection: 'column',
219
- minHeight: needsCodeEditorLayout && isCodeParam ? '300px' : 0
220
- }}
221
- >
222
- <ParameterRenderer
223
- parameter={param}
224
- value={parameters[param.name]}
225
- onChange={(value) => onParameterChange(param.name, value)}
226
- allParameters={parameters}
227
- onParameterChange={onParameterChange}
228
- onClosePanel={() => {}}
229
- isLoadingParameters={isLoadingParameters}
230
- />
231
- </div>
232
- );
233
- })}
234
-
235
- {/* Tool Schema Editor - Only for tool nodes */}
236
- {isToolNode && (
237
- <ToolSchemaEditor
238
- nodeId={nodeId}
239
- toolName={parameters.toolName || nodeDefinition.name}
240
- toolDescription={parameters.toolDescription || nodeDefinition.description || ''}
241
- />
242
- )}
243
- </div>
244
-
245
- {/* Connected Skills Section - Only for Chat Agent nodes */}
246
- {isChatAgentNode && (
247
- <div style={{
248
- marginTop: theme.spacing.lg,
249
- backgroundColor: theme.colors.background,
250
- border: `1px solid ${theme.colors.border}`,
251
- borderRadius: theme.borderRadius.md,
252
- boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
253
- overflow: 'hidden'
254
- }}>
255
- {/* Skills Header */}
256
- <div
257
- onClick={() => setIsSkillsExpanded(!isSkillsExpanded)}
258
- style={{
259
- display: 'flex',
260
- alignItems: 'center',
261
- justifyContent: 'space-between',
262
- padding: `${theme.spacing.sm} ${theme.spacing.md}`,
263
- backgroundColor: theme.colors.backgroundAlt,
264
- borderBottom: isSkillsExpanded ? `1px solid ${theme.colors.border}` : 'none',
265
- cursor: 'pointer',
266
- userSelect: 'none'
267
- }}
268
- >
269
- <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
270
- <svg
271
- width="14"
272
- height="14"
273
- viewBox="0 0 24 24"
274
- fill="none"
275
- stroke={theme.colors.textSecondary}
276
- strokeWidth="2"
277
- strokeLinecap="round"
278
- strokeLinejoin="round"
279
- style={{
280
- transform: isSkillsExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
281
- transition: 'transform 0.2s ease'
282
- }}
283
- >
284
- <polyline points="9 18 15 12 9 6" />
285
- </svg>
286
- <svg
287
- width="14"
288
- height="14"
289
- viewBox="0 0 24 24"
290
- fill="none"
291
- stroke={theme.dracula.purple}
292
- strokeWidth="2"
293
- strokeLinecap="round"
294
- strokeLinejoin="round"
295
- >
296
- <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
297
- </svg>
298
- <span style={{
299
- fontSize: theme.fontSize.sm,
300
- fontWeight: theme.fontWeight.medium,
301
- color: theme.colors.text
302
- }}>
303
- Connected Skills
304
- </span>
305
- </div>
306
- <span style={{
307
- fontSize: theme.fontSize.xs,
308
- color: connectedSkills.length > 0 ? theme.dracula.purple : theme.colors.textMuted,
309
- padding: `2px ${theme.spacing.sm}`,
310
- backgroundColor: connectedSkills.length > 0 ? theme.dracula.purple + '20' : theme.colors.backgroundAlt,
311
- borderRadius: theme.borderRadius.sm,
312
- fontWeight: theme.fontWeight.medium
313
- }}>
314
- {connectedSkills.length}
315
- </span>
316
- </div>
317
-
318
- {/* Skills Content */}
319
- {isSkillsExpanded && (
320
- <div style={{ padding: theme.spacing.md }}>
321
- {connectedSkills.length === 0 ? (
322
- <div style={{
323
- display: 'flex',
324
- flexDirection: 'column',
325
- alignItems: 'center',
326
- justifyContent: 'center',
327
- padding: theme.spacing.lg,
328
- color: theme.colors.textMuted,
329
- textAlign: 'center'
330
- }}>
331
- <svg
332
- width="32"
333
- height="32"
334
- viewBox="0 0 24 24"
335
- fill="none"
336
- stroke={theme.colors.textMuted}
337
- strokeWidth="1.5"
338
- strokeLinecap="round"
339
- strokeLinejoin="round"
340
- style={{ marginBottom: theme.spacing.sm, opacity: 0.5 }}
341
- >
342
- <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
343
- </svg>
344
- <span style={{ fontSize: theme.fontSize.sm, marginBottom: theme.spacing.xs }}>
345
- No skills connected
346
- </span>
347
- <span style={{ fontSize: theme.fontSize.xs }}>
348
- Connect skill nodes to the Skill handle to add capabilities
349
- </span>
350
- </div>
351
- ) : (
352
- <div style={{ display: 'flex', flexDirection: 'column', gap: theme.spacing.sm }}>
353
- {connectedSkills.map((skill) => (
354
- <div
355
- key={skill.id}
356
- style={{
357
- display: 'flex',
358
- alignItems: 'flex-start',
359
- gap: theme.spacing.md,
360
- padding: theme.spacing.md,
361
- backgroundColor: theme.colors.backgroundAlt,
362
- borderRadius: theme.borderRadius.md,
363
- border: `1px solid ${theme.colors.border}`,
364
- borderLeft: `3px solid ${skill.color}`
365
- }}
366
- >
367
- {/* Skill Icon */}
368
- <div style={{
369
- width: 36,
370
- height: 36,
371
- borderRadius: theme.borderRadius.md,
372
- backgroundColor: skill.color + '20',
373
- display: 'flex',
374
- alignItems: 'center',
375
- justifyContent: 'center',
376
- flexShrink: 0
377
- }}>
378
- <span style={{ fontSize: 18 }}>{skill.icon}</span>
379
- </div>
380
-
381
- {/* Skill Info */}
382
- <div style={{ flex: 1, minWidth: 0 }}>
383
- <div style={{
384
- fontSize: theme.fontSize.sm,
385
- fontWeight: theme.fontWeight.semibold,
386
- color: theme.colors.text,
387
- marginBottom: 2
388
- }}>
389
- {skill.name}
390
- </div>
391
- <div style={{
392
- fontSize: theme.fontSize.xs,
393
- color: theme.colors.textMuted,
394
- overflow: 'hidden',
395
- textOverflow: 'ellipsis',
396
- display: '-webkit-box',
397
- WebkitLineClamp: 2,
398
- WebkitBoxOrient: 'vertical'
399
- }}>
400
- {skill.description}
401
- </div>
402
- </div>
403
-
404
- {/* Active Badge */}
405
- <div style={{
406
- fontSize: '10px',
407
- fontWeight: theme.fontWeight.medium,
408
- color: theme.dracula.green,
409
- padding: `2px ${theme.spacing.xs}`,
410
- backgroundColor: theme.dracula.green + '20',
411
- borderRadius: theme.borderRadius.sm,
412
- flexShrink: 0
413
- }}>
414
- Active
415
- </div>
416
- </div>
417
- ))}
418
- </div>
419
- )}
420
- </div>
421
- )}
422
- </div>
423
- )}
424
- </div>
425
-
426
- {/* Console Output Section - Only for Python nodes */}
427
- {isCodeExecutorNode && (
428
- <div style={{
429
- padding: `0 ${theme.spacing.xl} ${theme.spacing.xl}`,
430
- flex: '1',
431
- minHeight: 0,
432
- display: 'flex',
433
- flexDirection: 'column'
434
- }}>
435
- <div style={{
436
- backgroundColor: theme.colors.background,
437
- border: `1px solid ${theme.colors.border}`,
438
- borderRadius: theme.borderRadius.md,
439
- boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
440
- overflow: 'hidden',
441
- flex: 1,
442
- display: 'flex',
443
- flexDirection: 'column',
444
- minHeight: 0
445
- }}>
446
- {/* Console Header */}
447
- <div
448
- onClick={() => setIsConsoleExpanded(!isConsoleExpanded)}
449
- style={{
450
- display: 'flex',
451
- alignItems: 'center',
452
- justifyContent: 'space-between',
453
- padding: `${theme.spacing.sm} ${theme.spacing.md}`,
454
- backgroundColor: theme.colors.backgroundAlt,
455
- borderBottom: isConsoleExpanded ? `1px solid ${theme.colors.border}` : 'none',
456
- cursor: 'pointer',
457
- userSelect: 'none'
458
- }}
459
- >
460
- <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
461
- <svg
462
- width="14"
463
- height="14"
464
- viewBox="0 0 24 24"
465
- fill="none"
466
- stroke={theme.colors.textSecondary}
467
- strokeWidth="2"
468
- strokeLinecap="round"
469
- strokeLinejoin="round"
470
- style={{
471
- transform: isConsoleExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
472
- transition: 'transform 0.2s ease'
473
- }}
474
- >
475
- <polyline points="9 18 15 12 9 6" />
476
- </svg>
477
- <svg
478
- width="14"
479
- height="14"
480
- viewBox="0 0 24 24"
481
- fill="none"
482
- stroke={theme.dracula.cyan}
483
- strokeWidth="2"
484
- strokeLinecap="round"
485
- strokeLinejoin="round"
486
- >
487
- <polyline points="4 17 10 11 4 5" />
488
- <line x1="12" y1="19" x2="20" y2="19" />
489
- </svg>
490
- <span style={{
491
- fontSize: theme.fontSize.sm,
492
- fontWeight: theme.fontWeight.medium,
493
- color: theme.colors.text
494
- }}>
495
- Console
496
- </span>
497
- </div>
498
- {consoleOutput && (
499
- <span style={{
500
- fontSize: theme.fontSize.xs,
501
- color: theme.dracula.green,
502
- padding: `2px ${theme.spacing.sm}`,
503
- backgroundColor: theme.dracula.green + '20',
504
- borderRadius: theme.borderRadius.sm
505
- }}>
506
- Output
507
- </span>
508
- )}
509
- </div>
510
-
511
- {/* Console Content */}
512
- {isConsoleExpanded && (
513
- <div style={{
514
- padding: theme.spacing.sm,
515
- backgroundColor: '#1a1a2e',
516
- flex: 1,
517
- minHeight: 0,
518
- overflowY: 'auto',
519
- fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
520
- fontSize: theme.fontSize.sm,
521
- lineHeight: '1.4'
522
- }}>
523
- {consoleOutput ? (
524
- <pre style={{
525
- margin: 0,
526
- whiteSpace: 'pre-wrap',
527
- wordBreak: 'break-word',
528
- color: consoleOutput.startsWith('Error') ? theme.dracula.red : theme.dracula.green
529
- }}>
530
- {consoleOutput}
531
- </pre>
532
- ) : (
533
- <div style={{
534
- display: 'flex',
535
- flexDirection: 'column',
536
- alignItems: 'center',
537
- justifyContent: 'center',
538
- height: '100%',
539
- minHeight: '40px',
540
- color: theme.colors.textMuted
541
- }}>
542
- <svg
543
- width="24"
544
- height="24"
545
- viewBox="0 0 24 24"
546
- fill="none"
547
- stroke={theme.colors.textMuted}
548
- strokeWidth="1.5"
549
- strokeLinecap="round"
550
- strokeLinejoin="round"
551
- style={{ marginBottom: theme.spacing.sm, opacity: 0.5 }}
552
- >
553
- <polyline points="4 17 10 11 4 5" />
554
- <line x1="12" y1="19" x2="20" y2="19" />
555
- </svg>
556
- <span style={{ fontSize: theme.fontSize.xs }}>
557
- Run the code to see console output
558
- </span>
559
- </div>
560
- )}
561
- </div>
562
- )}
563
- </div>
564
- </div>
565
- )}
566
- </div>
567
- </div>
568
- );
569
- };
570
-
571
- export default MiddleSection;
1
+ import React, { useState, useEffect } from 'react';
2
+ import ParameterRenderer from '../ParameterRenderer';
3
+ import ToolSchemaEditor from './ToolSchemaEditor';
4
+ import { useAppTheme } from '../../hooks/useAppTheme';
5
+ import { useAppStore } from '../../store/useAppStore';
6
+ import { useWebSocket } from '../../contexts/WebSocketContext';
7
+ import { nodeDefinitions } from '../../nodeDefinitions';
8
+ import { INodeTypeDescription, INodeProperties } from '../../types/INodeProperties';
9
+ import { ExecutionResult } from '../../services/executionService';
10
+ import { Edge } from 'reactflow';
11
+ import { SKILL_NODE_TYPES } from '../../nodeDefinitions/skillNodes';
12
+
13
+ // Tool node types that support schema editing
14
+ const TOOL_NODE_TYPES = ['androidTool', 'calculatorTool', 'currentTimeTool', 'webSearchTool'];
15
+
16
+ interface ConnectedSkill {
17
+ id: string;
18
+ name: string;
19
+ type: string;
20
+ icon: string;
21
+ description: string;
22
+ color: string;
23
+ }
24
+
25
+ interface MiddleSectionProps {
26
+ nodeId: string;
27
+ nodeDefinition: INodeTypeDescription;
28
+ parameters: Record<string, any>;
29
+ onParameterChange: (paramName: string, value: any) => void;
30
+ isLoadingParameters?: boolean;
31
+ executionResults?: ExecutionResult[];
32
+ }
33
+
34
+ const shouldShowParameter = (param: INodeProperties, allParameters: Record<string, any>): boolean => {
35
+ if (!param.displayOptions?.show) {
36
+ return true;
37
+ }
38
+
39
+ const showConditions = param.displayOptions.show;
40
+
41
+ for (const [paramName, allowedValues] of Object.entries(showConditions)) {
42
+ const currentValue = allParameters[paramName];
43
+
44
+ if (Array.isArray(allowedValues)) {
45
+ if (!allowedValues.includes(currentValue)) {
46
+ return false;
47
+ }
48
+ } else {
49
+ if (currentValue !== allowedValues) {
50
+ return false;
51
+ }
52
+ }
53
+ }
54
+
55
+ return true;
56
+ };
57
+
58
+ const MiddleSection: React.FC<MiddleSectionProps> = ({
59
+ nodeId,
60
+ nodeDefinition,
61
+ parameters,
62
+ onParameterChange,
63
+ isLoadingParameters = false,
64
+ executionResults = []
65
+ }) => {
66
+ const theme = useAppTheme();
67
+ const { currentWorkflow } = useAppStore();
68
+ const { clearMemory, resetSkill } = useWebSocket();
69
+ const [isConsoleExpanded, setIsConsoleExpanded] = useState(true);
70
+ const [connectedSkills, setConnectedSkills] = useState<ConnectedSkill[]>([]);
71
+ const [isSkillsExpanded, setIsSkillsExpanded] = useState(true);
72
+
73
+ // Clear/Reset dialog state
74
+ const [showClearMemoryDialog, setShowClearMemoryDialog] = useState(false);
75
+ const [showResetSkillDialog, setShowResetSkillDialog] = useState(false);
76
+ const [clearLongTermMemory, setClearLongTermMemory] = useState(false);
77
+ const [isProcessing, setIsProcessing] = useState(false);
78
+
79
+ // Clear memory handler
80
+ const handleClearMemory = async () => {
81
+ setIsProcessing(true);
82
+ try {
83
+ const sessionId = parameters.sessionId || 'default';
84
+ const result = await clearMemory(sessionId, clearLongTermMemory);
85
+ if (result.success && result.default_content) {
86
+ onParameterChange('memoryContent', result.default_content);
87
+ }
88
+ } finally {
89
+ setIsProcessing(false);
90
+ setShowClearMemoryDialog(false);
91
+ setClearLongTermMemory(false);
92
+ }
93
+ };
94
+
95
+ // Reset skill handler
96
+ const handleResetSkill = async () => {
97
+ setIsProcessing(true);
98
+ try {
99
+ const skillName = parameters.skillName;
100
+ if (!skillName) return;
101
+ const result = await resetSkill(skillName);
102
+ if (result.success && result.original_content) {
103
+ onParameterChange('instructions', result.original_content);
104
+ }
105
+ } finally {
106
+ setIsProcessing(false);
107
+ setShowResetSkillDialog(false);
108
+ }
109
+ };
110
+
111
+ const visibleParams = (nodeDefinition.properties || [])
112
+ .filter((param: INodeProperties) => shouldShowParameter(param, parameters));
113
+
114
+ // Check if this is a code executor node (Python or JavaScript)
115
+ const isCodeExecutorNode = nodeDefinition.name === 'pythonExecutor' || nodeDefinition.name === 'javascriptExecutor';
116
+
117
+ // Check if this is a skill node with code editor (needs similar flex layout)
118
+ const isSkillNode = SKILL_NODE_TYPES.includes(nodeDefinition.name) && nodeDefinition.name !== 'customSkill';
119
+
120
+ // Check if this is a memory node with markdown editor
121
+ const isMemoryNode = nodeDefinition.name === 'simpleMemory';
122
+
123
+ // Nodes that need flexible code editor layout
124
+ const needsCodeEditorLayout = isCodeExecutorNode || isSkillNode || isMemoryNode;
125
+
126
+ // Check if this is a tool node that supports schema editing
127
+ const isToolNode = TOOL_NODE_TYPES.includes(nodeDefinition.name);
128
+
129
+ // Check if this is a Zeenie node
130
+ const isChatAgentNode = nodeDefinition.name === 'chatAgent';
131
+
132
+ // Get connected skills for Zeenie nodes
133
+ useEffect(() => {
134
+ if (!isChatAgentNode || !currentWorkflow) {
135
+ setConnectedSkills([]);
136
+ return;
137
+ }
138
+
139
+ const nodes = currentWorkflow.nodes || [];
140
+ const edges = currentWorkflow.edges || [];
141
+
142
+ // Find edges connecting to this node's input-skill handle
143
+ const skillEdges = edges.filter((edge: Edge) =>
144
+ edge.target === nodeId && edge.targetHandle === 'input-skill'
145
+ );
146
+
147
+ // Get skill node data
148
+ const skills: ConnectedSkill[] = skillEdges.map((edge: Edge) => {
149
+ const sourceNode = nodes.find((n: any) => n.id === edge.source);
150
+ const nodeType = sourceNode?.type || '';
151
+ const nodeDef = nodeDefinitions[nodeType];
152
+
153
+ return {
154
+ id: edge.source,
155
+ name: sourceNode?.data?.label || nodeDef?.displayName || nodeType,
156
+ type: nodeType,
157
+ icon: nodeDef?.icon || '',
158
+ description: nodeDef?.description || '',
159
+ color: nodeDef?.defaults?.color as string || '#6366F1',
160
+ };
161
+ });
162
+
163
+ setConnectedSkills(skills);
164
+ }, [nodeId, isChatAgentNode, currentWorkflow]);
165
+
166
+ // Extract console output from execution results
167
+ const getConsoleOutput = (): string => {
168
+ if (executionResults.length === 0) return '';
169
+
170
+ const latestResult = executionResults[0];
171
+ const outputs = latestResult.outputs || latestResult.data || latestResult.nodeData?.[0]?.[0]?.json;
172
+
173
+ if (!outputs) return '';
174
+
175
+ // Check for console_output or stdout in the result
176
+ if (outputs.console_output) return outputs.console_output;
177
+ if (outputs.stdout) return outputs.stdout;
178
+ if (outputs.result?.console_output) return outputs.result.console_output;
179
+ if (outputs.result?.stdout) return outputs.result.stdout;
180
+
181
+ // Check for error output
182
+ if (latestResult.error) return `Error: ${latestResult.error}`;
183
+ if (outputs.error) return `Error: ${outputs.error}`;
184
+ if (outputs.stderr) return `Error: ${outputs.stderr}`;
185
+
186
+ return '';
187
+ };
188
+
189
+ const consoleOutput = isCodeExecutorNode ? getConsoleOutput() : '';
190
+
191
+ return (
192
+ <div style={{
193
+ flex: 1,
194
+ display: 'flex',
195
+ flexDirection: 'column',
196
+ height: '100%',
197
+ overflow: 'hidden',
198
+ position: 'relative'
199
+ }}>
200
+ {/* Description - hide for code editor nodes (Python, Skill) */}
201
+ {!needsCodeEditorLayout && (
202
+ <div style={{
203
+ padding: `${theme.spacing.lg} ${theme.spacing.xl} ${theme.spacing.sm}`,
204
+ borderBottom: `1px solid ${theme.colors.border}`,
205
+ backgroundColor: theme.colors.backgroundAlt,
206
+ flexShrink: 0
207
+ }}>
208
+ <p style={{
209
+ margin: 0,
210
+ fontSize: theme.fontSize.base,
211
+ color: theme.colors.textSecondary,
212
+ lineHeight: '1.5',
213
+ }}>
214
+ {nodeDefinition.description}
215
+ </p>
216
+ </div>
217
+ )}
218
+
219
+ {/* Main Content Area - Flexible */}
220
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, overflow: 'hidden' }}>
221
+ {/* Parameters */}
222
+ <div style={{
223
+ padding: theme.spacing.xl,
224
+ flex: needsCodeEditorLayout ? '3' : 1,
225
+ overflowY: needsCodeEditorLayout ? 'hidden' : 'auto',
226
+ overflowX: 'hidden',
227
+ width: '100%',
228
+ boxSizing: 'border-box',
229
+ minHeight: 0,
230
+ display: needsCodeEditorLayout ? 'flex' : 'block',
231
+ flexDirection: 'column'
232
+ }}>
233
+ {/* Parameters Container */}
234
+ <div style={{
235
+ backgroundColor: theme.colors.background,
236
+ border: `1px solid ${theme.colors.border}`,
237
+ borderRadius: theme.borderRadius.md,
238
+ padding: theme.spacing.lg,
239
+ boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
240
+ height: needsCodeEditorLayout ? '100%' : 'auto',
241
+ display: needsCodeEditorLayout ? 'flex' : 'block',
242
+ flexDirection: 'column',
243
+ boxSizing: 'border-box'
244
+ }}>
245
+ {/* All Parameters - standard n8n style */}
246
+ {visibleParams.map((param: INodeProperties, index: number) => {
247
+ // Check if this parameter is a code editor - give it more flex space
248
+ const isCodeParam = (param as any).typeOptions?.editor === 'code';
249
+ return (
250
+ <div
251
+ key={param.name}
252
+ style={{
253
+ paddingBottom: index < visibleParams.length - 1 ? theme.spacing.md : 0,
254
+ marginBottom: index < visibleParams.length - 1 ? theme.spacing.md : 0,
255
+ borderBottom: index < visibleParams.length - 1 ? `1px solid ${theme.colors.border}` : 'none',
256
+ flex: needsCodeEditorLayout && isCodeParam ? 1 : 'none',
257
+ display: needsCodeEditorLayout ? 'flex' : 'block',
258
+ flexDirection: 'column',
259
+ minHeight: needsCodeEditorLayout && isCodeParam ? '300px' : 0
260
+ }}
261
+ >
262
+ <ParameterRenderer
263
+ parameter={param}
264
+ value={parameters[param.name]}
265
+ onChange={(value) => onParameterChange(param.name, value)}
266
+ allParameters={parameters}
267
+ onParameterChange={onParameterChange}
268
+ onClosePanel={() => {}}
269
+ isLoadingParameters={isLoadingParameters}
270
+ />
271
+ </div>
272
+ );
273
+ })}
274
+
275
+ {/* Tool Schema Editor - Only for tool nodes */}
276
+ {isToolNode && (
277
+ <ToolSchemaEditor
278
+ nodeId={nodeId}
279
+ toolName={parameters.toolName || nodeDefinition.name}
280
+ toolDescription={parameters.toolDescription || nodeDefinition.description || ''}
281
+ />
282
+ )}
283
+
284
+ {/* Clear Memory Button - Only for memory nodes */}
285
+ {isMemoryNode && (
286
+ <div style={{
287
+ display: 'flex',
288
+ justifyContent: 'flex-end',
289
+ paddingTop: theme.spacing.md,
290
+ marginTop: theme.spacing.md,
291
+ borderTop: `1px solid ${theme.colors.border}`
292
+ }}>
293
+ <button
294
+ onClick={() => setShowClearMemoryDialog(true)}
295
+ style={{
296
+ display: 'flex',
297
+ alignItems: 'center',
298
+ gap: '6px',
299
+ padding: '6px 12px',
300
+ backgroundColor: `${theme.dracula.red}20`,
301
+ color: theme.dracula.red,
302
+ border: `1px solid ${theme.dracula.red}50`,
303
+ borderRadius: theme.borderRadius.sm,
304
+ fontSize: theme.fontSize.sm,
305
+ fontWeight: theme.fontWeight.medium,
306
+ cursor: 'pointer',
307
+ transition: 'all 0.15s ease'
308
+ }}
309
+ >
310
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
311
+ <polyline points="3 6 5 6 21 6" />
312
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
313
+ </svg>
314
+ Clear Memory
315
+ </button>
316
+ </div>
317
+ )}
318
+
319
+ {/* Reset Skill Button - Only for built-in skill nodes */}
320
+ {isSkillNode && (
321
+ <div style={{
322
+ display: 'flex',
323
+ justifyContent: 'flex-end',
324
+ paddingTop: theme.spacing.md,
325
+ marginTop: theme.spacing.md,
326
+ borderTop: `1px solid ${theme.colors.border}`
327
+ }}>
328
+ <button
329
+ onClick={() => setShowResetSkillDialog(true)}
330
+ style={{
331
+ display: 'flex',
332
+ alignItems: 'center',
333
+ gap: '6px',
334
+ padding: '6px 12px',
335
+ backgroundColor: `${theme.dracula.orange}20`,
336
+ color: theme.dracula.orange,
337
+ border: `1px solid ${theme.dracula.orange}50`,
338
+ borderRadius: theme.borderRadius.sm,
339
+ fontSize: theme.fontSize.sm,
340
+ fontWeight: theme.fontWeight.medium,
341
+ cursor: 'pointer',
342
+ transition: 'all 0.15s ease'
343
+ }}
344
+ >
345
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
346
+ <polyline points="1 4 1 10 7 10" />
347
+ <path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
348
+ </svg>
349
+ Reset to Default
350
+ </button>
351
+ </div>
352
+ )}
353
+ </div>
354
+
355
+ {/* Clear Memory Confirmation Dialog */}
356
+ {showClearMemoryDialog && (
357
+ <div style={{
358
+ position: 'fixed',
359
+ top: 0,
360
+ left: 0,
361
+ right: 0,
362
+ bottom: 0,
363
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
364
+ display: 'flex',
365
+ alignItems: 'center',
366
+ justifyContent: 'center',
367
+ zIndex: 9999
368
+ }}>
369
+ <div style={{
370
+ backgroundColor: theme.colors.background,
371
+ borderRadius: theme.borderRadius.lg,
372
+ border: `1px solid ${theme.colors.border}`,
373
+ padding: theme.spacing.xl,
374
+ maxWidth: '400px',
375
+ width: '90%',
376
+ boxShadow: '0 10px 40px rgba(0, 0, 0, 0.3)'
377
+ }}>
378
+ <h3 style={{
379
+ margin: `0 0 ${theme.spacing.md}`,
380
+ fontSize: theme.fontSize.lg,
381
+ fontWeight: theme.fontWeight.semibold,
382
+ color: theme.colors.text
383
+ }}>
384
+ Clear Conversation Memory
385
+ </h3>
386
+ <p style={{
387
+ margin: `0 0 ${theme.spacing.lg}`,
388
+ fontSize: theme.fontSize.sm,
389
+ color: theme.colors.textSecondary,
390
+ lineHeight: 1.5
391
+ }}>
392
+ This will reset the conversation history to its initial state. This action cannot be undone.
393
+ </p>
394
+
395
+ {/* Long-term memory checkbox */}
396
+ {parameters.longTermEnabled && (
397
+ <label style={{
398
+ display: 'flex',
399
+ alignItems: 'center',
400
+ gap: '8px',
401
+ marginBottom: theme.spacing.lg,
402
+ fontSize: theme.fontSize.sm,
403
+ color: theme.colors.text,
404
+ cursor: 'pointer'
405
+ }}>
406
+ <input
407
+ type="checkbox"
408
+ checked={clearLongTermMemory}
409
+ onChange={(e) => setClearLongTermMemory(e.target.checked)}
410
+ style={{ width: 16, height: 16 }}
411
+ />
412
+ Also clear long-term memory (vector store)
413
+ </label>
414
+ )}
415
+
416
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: theme.spacing.sm }}>
417
+ <button
418
+ onClick={() => {
419
+ setShowClearMemoryDialog(false);
420
+ setClearLongTermMemory(false);
421
+ }}
422
+ disabled={isProcessing}
423
+ style={{
424
+ padding: '8px 16px',
425
+ backgroundColor: theme.colors.backgroundAlt,
426
+ color: theme.colors.text,
427
+ border: `1px solid ${theme.colors.border}`,
428
+ borderRadius: theme.borderRadius.sm,
429
+ fontSize: theme.fontSize.sm,
430
+ fontWeight: theme.fontWeight.medium,
431
+ cursor: isProcessing ? 'not-allowed' : 'pointer'
432
+ }}
433
+ >
434
+ Cancel
435
+ </button>
436
+ <button
437
+ onClick={handleClearMemory}
438
+ disabled={isProcessing}
439
+ style={{
440
+ padding: '8px 16px',
441
+ backgroundColor: theme.dracula.red,
442
+ color: '#fff',
443
+ border: 'none',
444
+ borderRadius: theme.borderRadius.sm,
445
+ fontSize: theme.fontSize.sm,
446
+ fontWeight: theme.fontWeight.medium,
447
+ cursor: isProcessing ? 'not-allowed' : 'pointer',
448
+ opacity: isProcessing ? 0.7 : 1
449
+ }}
450
+ >
451
+ {isProcessing ? 'Clearing...' : 'Clear Memory'}
452
+ </button>
453
+ </div>
454
+ </div>
455
+ </div>
456
+ )}
457
+
458
+ {/* Reset Skill Confirmation Dialog */}
459
+ {showResetSkillDialog && (
460
+ <div style={{
461
+ position: 'fixed',
462
+ top: 0,
463
+ left: 0,
464
+ right: 0,
465
+ bottom: 0,
466
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
467
+ display: 'flex',
468
+ alignItems: 'center',
469
+ justifyContent: 'center',
470
+ zIndex: 9999
471
+ }}>
472
+ <div style={{
473
+ backgroundColor: theme.colors.background,
474
+ borderRadius: theme.borderRadius.lg,
475
+ border: `1px solid ${theme.colors.border}`,
476
+ padding: theme.spacing.xl,
477
+ maxWidth: '400px',
478
+ width: '90%',
479
+ boxShadow: '0 10px 40px rgba(0, 0, 0, 0.3)'
480
+ }}>
481
+ <h3 style={{
482
+ margin: `0 0 ${theme.spacing.md}`,
483
+ fontSize: theme.fontSize.lg,
484
+ fontWeight: theme.fontWeight.semibold,
485
+ color: theme.colors.text
486
+ }}>
487
+ Reset Skill to Default
488
+ </h3>
489
+ <p style={{
490
+ margin: `0 0 ${theme.spacing.lg}`,
491
+ fontSize: theme.fontSize.sm,
492
+ color: theme.colors.textSecondary,
493
+ lineHeight: 1.5
494
+ }}>
495
+ This will restore the skill instructions to their original content. Any customizations will be lost.
496
+ </p>
497
+
498
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: theme.spacing.sm }}>
499
+ <button
500
+ onClick={() => setShowResetSkillDialog(false)}
501
+ disabled={isProcessing}
502
+ style={{
503
+ padding: '8px 16px',
504
+ backgroundColor: theme.colors.backgroundAlt,
505
+ color: theme.colors.text,
506
+ border: `1px solid ${theme.colors.border}`,
507
+ borderRadius: theme.borderRadius.sm,
508
+ fontSize: theme.fontSize.sm,
509
+ fontWeight: theme.fontWeight.medium,
510
+ cursor: isProcessing ? 'not-allowed' : 'pointer'
511
+ }}
512
+ >
513
+ Cancel
514
+ </button>
515
+ <button
516
+ onClick={handleResetSkill}
517
+ disabled={isProcessing}
518
+ style={{
519
+ padding: '8px 16px',
520
+ backgroundColor: theme.dracula.orange,
521
+ color: '#fff',
522
+ border: 'none',
523
+ borderRadius: theme.borderRadius.sm,
524
+ fontSize: theme.fontSize.sm,
525
+ fontWeight: theme.fontWeight.medium,
526
+ cursor: isProcessing ? 'not-allowed' : 'pointer',
527
+ opacity: isProcessing ? 0.7 : 1
528
+ }}
529
+ >
530
+ {isProcessing ? 'Resetting...' : 'Reset to Default'}
531
+ </button>
532
+ </div>
533
+ </div>
534
+ </div>
535
+ )}
536
+
537
+ {/* Connected Skills Section - Only for Zeenie nodes */}
538
+ {isChatAgentNode && (
539
+ <div style={{
540
+ marginTop: theme.spacing.lg,
541
+ backgroundColor: theme.colors.background,
542
+ border: `1px solid ${theme.colors.border}`,
543
+ borderRadius: theme.borderRadius.md,
544
+ boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
545
+ overflow: 'hidden'
546
+ }}>
547
+ {/* Skills Header */}
548
+ <div
549
+ onClick={() => setIsSkillsExpanded(!isSkillsExpanded)}
550
+ style={{
551
+ display: 'flex',
552
+ alignItems: 'center',
553
+ justifyContent: 'space-between',
554
+ padding: `${theme.spacing.sm} ${theme.spacing.md}`,
555
+ backgroundColor: theme.colors.backgroundAlt,
556
+ borderBottom: isSkillsExpanded ? `1px solid ${theme.colors.border}` : 'none',
557
+ cursor: 'pointer',
558
+ userSelect: 'none'
559
+ }}
560
+ >
561
+ <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
562
+ <svg
563
+ width="14"
564
+ height="14"
565
+ viewBox="0 0 24 24"
566
+ fill="none"
567
+ stroke={theme.colors.textSecondary}
568
+ strokeWidth="2"
569
+ strokeLinecap="round"
570
+ strokeLinejoin="round"
571
+ style={{
572
+ transform: isSkillsExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
573
+ transition: 'transform 0.2s ease'
574
+ }}
575
+ >
576
+ <polyline points="9 18 15 12 9 6" />
577
+ </svg>
578
+ <svg
579
+ width="14"
580
+ height="14"
581
+ viewBox="0 0 24 24"
582
+ fill="none"
583
+ stroke={theme.dracula.purple}
584
+ strokeWidth="2"
585
+ strokeLinecap="round"
586
+ strokeLinejoin="round"
587
+ >
588
+ <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
589
+ </svg>
590
+ <span style={{
591
+ fontSize: theme.fontSize.sm,
592
+ fontWeight: theme.fontWeight.medium,
593
+ color: theme.colors.text
594
+ }}>
595
+ Connected Skills
596
+ </span>
597
+ </div>
598
+ <span style={{
599
+ fontSize: theme.fontSize.xs,
600
+ color: connectedSkills.length > 0 ? theme.dracula.purple : theme.colors.textMuted,
601
+ padding: `2px ${theme.spacing.sm}`,
602
+ backgroundColor: connectedSkills.length > 0 ? theme.dracula.purple + '20' : theme.colors.backgroundAlt,
603
+ borderRadius: theme.borderRadius.sm,
604
+ fontWeight: theme.fontWeight.medium
605
+ }}>
606
+ {connectedSkills.length}
607
+ </span>
608
+ </div>
609
+
610
+ {/* Skills Content */}
611
+ {isSkillsExpanded && (
612
+ <div style={{ padding: theme.spacing.md }}>
613
+ {connectedSkills.length === 0 ? (
614
+ <div style={{
615
+ display: 'flex',
616
+ flexDirection: 'column',
617
+ alignItems: 'center',
618
+ justifyContent: 'center',
619
+ padding: theme.spacing.lg,
620
+ color: theme.colors.textMuted,
621
+ textAlign: 'center'
622
+ }}>
623
+ <svg
624
+ width="32"
625
+ height="32"
626
+ viewBox="0 0 24 24"
627
+ fill="none"
628
+ stroke={theme.colors.textMuted}
629
+ strokeWidth="1.5"
630
+ strokeLinecap="round"
631
+ strokeLinejoin="round"
632
+ style={{ marginBottom: theme.spacing.sm, opacity: 0.5 }}
633
+ >
634
+ <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
635
+ </svg>
636
+ <span style={{ fontSize: theme.fontSize.sm, marginBottom: theme.spacing.xs }}>
637
+ No skills connected
638
+ </span>
639
+ <span style={{ fontSize: theme.fontSize.xs }}>
640
+ Connect skill nodes to the Skill handle to add capabilities
641
+ </span>
642
+ </div>
643
+ ) : (
644
+ <div style={{ display: 'flex', flexDirection: 'column', gap: theme.spacing.sm }}>
645
+ {connectedSkills.map((skill) => (
646
+ <div
647
+ key={skill.id}
648
+ style={{
649
+ display: 'flex',
650
+ alignItems: 'flex-start',
651
+ gap: theme.spacing.md,
652
+ padding: theme.spacing.md,
653
+ backgroundColor: theme.colors.backgroundAlt,
654
+ borderRadius: theme.borderRadius.md,
655
+ border: `1px solid ${theme.colors.border}`,
656
+ borderLeft: `3px solid ${skill.color}`
657
+ }}
658
+ >
659
+ {/* Skill Icon */}
660
+ <div style={{
661
+ width: 36,
662
+ height: 36,
663
+ borderRadius: theme.borderRadius.md,
664
+ backgroundColor: skill.color + '20',
665
+ display: 'flex',
666
+ alignItems: 'center',
667
+ justifyContent: 'center',
668
+ flexShrink: 0
669
+ }}>
670
+ {skill.icon.startsWith('data:') ? (
671
+ <img src={skill.icon} alt={skill.name} style={{ width: 20, height: 20 }} />
672
+ ) : (
673
+ <span style={{ fontSize: 18 }}>{skill.icon}</span>
674
+ )}
675
+ </div>
676
+
677
+ {/* Skill Info */}
678
+ <div style={{ flex: 1, minWidth: 0 }}>
679
+ <div style={{
680
+ fontSize: theme.fontSize.sm,
681
+ fontWeight: theme.fontWeight.semibold,
682
+ color: theme.colors.text,
683
+ marginBottom: 2
684
+ }}>
685
+ {skill.name}
686
+ </div>
687
+ <div style={{
688
+ fontSize: theme.fontSize.xs,
689
+ color: theme.colors.textMuted,
690
+ overflow: 'hidden',
691
+ textOverflow: 'ellipsis',
692
+ display: '-webkit-box',
693
+ WebkitLineClamp: 2,
694
+ WebkitBoxOrient: 'vertical'
695
+ }}>
696
+ {skill.description}
697
+ </div>
698
+ </div>
699
+
700
+ {/* Active Badge */}
701
+ <div style={{
702
+ fontSize: '10px',
703
+ fontWeight: theme.fontWeight.medium,
704
+ color: theme.dracula.green,
705
+ padding: `2px ${theme.spacing.xs}`,
706
+ backgroundColor: theme.dracula.green + '20',
707
+ borderRadius: theme.borderRadius.sm,
708
+ flexShrink: 0
709
+ }}>
710
+ Active
711
+ </div>
712
+ </div>
713
+ ))}
714
+ </div>
715
+ )}
716
+ </div>
717
+ )}
718
+ </div>
719
+ )}
720
+ </div>
721
+
722
+ {/* Console Output Section - Only for Python nodes */}
723
+ {isCodeExecutorNode && (
724
+ <div style={{
725
+ padding: `0 ${theme.spacing.xl} ${theme.spacing.xl}`,
726
+ flex: '1',
727
+ minHeight: 0,
728
+ display: 'flex',
729
+ flexDirection: 'column'
730
+ }}>
731
+ <div style={{
732
+ backgroundColor: theme.colors.background,
733
+ border: `1px solid ${theme.colors.border}`,
734
+ borderRadius: theme.borderRadius.md,
735
+ boxShadow: `0 1px 3px ${theme.colors.shadowLight}`,
736
+ overflow: 'hidden',
737
+ flex: 1,
738
+ display: 'flex',
739
+ flexDirection: 'column',
740
+ minHeight: 0
741
+ }}>
742
+ {/* Console Header */}
743
+ <div
744
+ onClick={() => setIsConsoleExpanded(!isConsoleExpanded)}
745
+ style={{
746
+ display: 'flex',
747
+ alignItems: 'center',
748
+ justifyContent: 'space-between',
749
+ padding: `${theme.spacing.sm} ${theme.spacing.md}`,
750
+ backgroundColor: theme.colors.backgroundAlt,
751
+ borderBottom: isConsoleExpanded ? `1px solid ${theme.colors.border}` : 'none',
752
+ cursor: 'pointer',
753
+ userSelect: 'none'
754
+ }}
755
+ >
756
+ <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
757
+ <svg
758
+ width="14"
759
+ height="14"
760
+ viewBox="0 0 24 24"
761
+ fill="none"
762
+ stroke={theme.colors.textSecondary}
763
+ strokeWidth="2"
764
+ strokeLinecap="round"
765
+ strokeLinejoin="round"
766
+ style={{
767
+ transform: isConsoleExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
768
+ transition: 'transform 0.2s ease'
769
+ }}
770
+ >
771
+ <polyline points="9 18 15 12 9 6" />
772
+ </svg>
773
+ <svg
774
+ width="14"
775
+ height="14"
776
+ viewBox="0 0 24 24"
777
+ fill="none"
778
+ stroke={theme.dracula.cyan}
779
+ strokeWidth="2"
780
+ strokeLinecap="round"
781
+ strokeLinejoin="round"
782
+ >
783
+ <polyline points="4 17 10 11 4 5" />
784
+ <line x1="12" y1="19" x2="20" y2="19" />
785
+ </svg>
786
+ <span style={{
787
+ fontSize: theme.fontSize.sm,
788
+ fontWeight: theme.fontWeight.medium,
789
+ color: theme.colors.text
790
+ }}>
791
+ Console
792
+ </span>
793
+ </div>
794
+ {consoleOutput && (
795
+ <span style={{
796
+ fontSize: theme.fontSize.xs,
797
+ color: theme.dracula.green,
798
+ padding: `2px ${theme.spacing.sm}`,
799
+ backgroundColor: theme.dracula.green + '20',
800
+ borderRadius: theme.borderRadius.sm
801
+ }}>
802
+ Output
803
+ </span>
804
+ )}
805
+ </div>
806
+
807
+ {/* Console Content */}
808
+ {isConsoleExpanded && (
809
+ <div style={{
810
+ padding: theme.spacing.sm,
811
+ backgroundColor: '#1a1a2e',
812
+ flex: 1,
813
+ minHeight: 0,
814
+ overflowY: 'auto',
815
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
816
+ fontSize: theme.fontSize.sm,
817
+ lineHeight: '1.4'
818
+ }}>
819
+ {consoleOutput ? (
820
+ <pre style={{
821
+ margin: 0,
822
+ whiteSpace: 'pre-wrap',
823
+ wordBreak: 'break-word',
824
+ color: consoleOutput.startsWith('Error') ? theme.dracula.red : theme.dracula.green
825
+ }}>
826
+ {consoleOutput}
827
+ </pre>
828
+ ) : (
829
+ <div style={{
830
+ display: 'flex',
831
+ flexDirection: 'column',
832
+ alignItems: 'center',
833
+ justifyContent: 'center',
834
+ height: '100%',
835
+ minHeight: '40px',
836
+ color: theme.colors.textMuted
837
+ }}>
838
+ <svg
839
+ width="24"
840
+ height="24"
841
+ viewBox="0 0 24 24"
842
+ fill="none"
843
+ stroke={theme.colors.textMuted}
844
+ strokeWidth="1.5"
845
+ strokeLinecap="round"
846
+ strokeLinejoin="round"
847
+ style={{ marginBottom: theme.spacing.sm, opacity: 0.5 }}
848
+ >
849
+ <polyline points="4 17 10 11 4 5" />
850
+ <line x1="12" y1="19" x2="20" y2="19" />
851
+ </svg>
852
+ <span style={{ fontSize: theme.fontSize.xs }}>
853
+ Run the code to see console output
854
+ </span>
855
+ </div>
856
+ )}
857
+ </div>
858
+ )}
859
+ </div>
860
+ </div>
861
+ )}
862
+ </div>
863
+ </div>
864
+ );
865
+ };
866
+
867
+ export default MiddleSection;